@snabcentr/vue-ui-lib 5.5.0 → 5.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/manifest.json +1 -1
- package/dist/release_notes.tmp +3 -19
- package/dist/sc-vue-ui-lib.js +2973 -2955
- package/dist/sc-vue-ui-lib.js.map +1 -1
- package/dist/sc-vue-ui-lib.umd.cjs +7 -7
- package/dist/sc-vue-ui-lib.umd.cjs.map +1 -1
- package/dist/src/values/reference-lists.d.ts +13 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(X,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("@snabcentr/common-lib"),require("lodash-es"),require("date-fns"),require("vue"),require("naive-ui"),require("libphonenumber-js"),require("ts-case-convert"),require("vue-tel-input")):typeof define=="function"&&define.amd?define(["exports","@snabcentr/common-lib","lodash-es","date-fns","vue","naive-ui","libphonenumber-js","ts-case-convert","vue-tel-input"],j):(X=typeof globalThis<"u"?globalThis:X||self,j(X.SC_VueUiLib={},X["@snabcentr/common-lib"],X["lodash-es"],X["date-fns"],X.Vue,X["naive-ui"],X["libphonenumber-js"],X["ts-case-convert"],X["vue-tel-input"]))})(this,(function(X,j,M,xe,t,F,xr,xs,Sm){"use strict";var NT=Object.defineProperty;var xm=X=>{throw TypeError(X)};var TT=(X,j,M)=>j in X?NT(X,j,{enumerable:!0,configurable:!0,writable:!0,value:M}):X[j]=M;var N=(X,j,M)=>TT(X,typeof j!="symbol"?j+"":j,M),km=(X,j,M)=>j.has(X)||xm("Cannot "+M);var Dt=(X,j,M)=>(km(X,j,"read from private field"),M?M.call(X):j.get(X)),Il=(X,j,M)=>j.has(X)?xm("Cannot add the same private member more than once"):j instanceof WeakSet?j.add(X):j.set(X,M),Cm=(X,j,M,xe)=>(km(X,j,"write to private field"),xe?xe.call(X,M):j.set(X,M),M);var Li,xt,ys;const kr="Чтобы изменить, включите режим управления",ks="Товар, который нужно предлагать клиенту",Cs="Категория, которую нужно предлагать клиенту",Et=class Et{static init(e,i){Et.messagesService&&Et.notificationsService||(Et.messagesService=e,Et.notificationsService=i)}static getMessagesService(){if(!Et.messagesService)throw new Error("UI provider is not initialized.");return Et.messagesService}static getNotificationsService(){if(!Et.notificationsService)throw new Error("UI provider is not initialized.");return Et.notificationsService}static showNotificationsForErrorResponseData(e,i={}){var r,o;if(M.isEmpty(e.errors)){const s=(o=(r=e.rawError)==null?void 0:r.config)==null?void 0:o.url,a=s?` [ ${s} ]`:"";Et.notificationsService?Et.notificationsService.error({title:"Ошибка выполнения/обработки запроса",content:e.message,meta:`#${e.status}${a}: ${e.statusText}`,duration:3e3}):console.log("Show notification error response data: UI provider is not initialized.",e)}else for(const s in e.errors)Object.prototype.hasOwnProperty.call(i,s)?i[s]=new j.FieldValidationResultData(e.errors[s].toString(),"error"):Et.messagesService?Et.messagesService.error(e.errors[s].toString()):console.log("Show notification error response data: UI provider is not initialized.",e.errors[s])}};N(Et,"messagesService"),N(Et,"notificationsService");let Cr=Et;const vr=new WeakMap,Bm=async n=>{const e=navigator.clipboard;if(e!=null&&e.writeText){await e.writeText(n);return}const i=document.createElement("textarea");i.value=n,i.style.position="fixed",i.style.opacity="0",document.body.append(i),i.select();const r=document.execCommand("copy");if(i.remove(),!r)throw new Error("Не удалось скопировать через execCommand.")},Ol=async n=>{const e=M.isNil(n)?"":String(n);if(e)try{await Bm(e),Cr.getNotificationsService().success({title:"Готово",description:`Скопировано в буфер обмена: ${e}`,duration:2e3})}catch{Cr.getNotificationsService().error({title:"Ошибка",description:"Не удалось скопировать в буфер обмена.",duration:3e3})}},Nm=n=>n.tagName==="BUTTON"||n.getAttribute("role")==="button"||!!n.closest("button"),Tm=(n,e)=>e.modifiers.click?"click":e.modifiers.dblclick?"dblclick":Nm(n)?"click":"dblclick",zl={mounted(n,e){n.style.setProperty("cursor","pointer");const i=Tm(n,e),r=o=>{var a;i==="dblclick"&&(o.preventDefault(),(a=globalThis.getSelection())==null||a.removeAllRanges());const s=vr.get(n);Ol(s==null?void 0:s.value).catch(M.noop)};vr.set(n,{value:e.value,eventName:i,handler:r}),n.addEventListener(i,r)},updated(n,e){const i=vr.get(n);i&&(i.value=e.value)},beforeUnmount(n){const e=vr.get(n);e&&(n.removeEventListener(e.eventName,e.handler),vr.delete(n))}},$m=new Set(["checkbox","radio","range","button","submit","reset","file","color","image","hidden"]),Em=".n-base-selection, .n-date-picker, .n-time-picker, .n-color-picker",oo=new WeakMap,Dl=n=>!$m.has(n.type)&&!n.disabled&&!n.readOnly&&n.closest(Em)===null&&n.getClientRects().length>0,Ll=n=>{var a;if(n.key!=="Enter"&&n.code!=="Enter"||n.shiftKey||n.isComposing)return;const{target:e}=n;if(!(e instanceof HTMLInputElement)||!Dl(e))return;n.preventDefault();const i=n.currentTarget,r=[...i.querySelectorAll("input")].filter(l=>Dl(l)),o=r.indexOf(e);if(o===-1)return;const s=r.at(o+1);if(s){s.focus(),s.select();return}(a=oo.get(i))==null||a()},oi={mounted(n,e){oo.set(n,e.value),n.addEventListener("keydown",Ll)},updated(n,e){oo.set(n,e.value)},unmounted(n){n.removeEventListener("keydown",Ll),oo.delete(n)}};var rt=(n=>(n.NotInStock="not_in_stock",n.OnOrder="on_order",n.LargeOrder="large_order",n.NextDayDelivery="next_day_delivery",n))(rt||{});const vs={color:"#4b5563",backgroundColor:"#e5e7eb",textOnBackgroundColor:"#1f2937"},Hl=new Map([[j.OrderStatusEnum.New,{color:"#15803d",backgroundColor:"#bbf7d0",textOnBackgroundColor:"#166534"}],[j.OrderStatusEnum.Processing,{color:"#ea580c",backgroundColor:"#fed7aa",textOnBackgroundColor:"#9a3412"}],[j.OrderStatusEnum.AwaitingSupplyProducts,{color:"#ca8a04",backgroundColor:"#fef08a",textOnBackgroundColor:"#854d0e"}],[j.OrderStatusEnum.InvoiceIssued,{color:"#1d4ed8",backgroundColor:"#bfdbfe",textOnBackgroundColor:"#1e40af"}],[j.OrderStatusEnum.ProcessingOnStock,{color:"#0e7490",backgroundColor:"#a5f3fc",textOnBackgroundColor:"#155e75"}],[j.OrderStatusEnum.OrderUpdated,{color:"#6d28d9",backgroundColor:"#ddd6fe",textOnBackgroundColor:"#5b21b6"}],[j.OrderStatusEnum.Finished,{color:"#475569",backgroundColor:"#e2e8f0",textOnBackgroundColor:"#1e293b"}],[j.OrderStatusEnum.Canceled,{color:"#b91c1c",backgroundColor:"#fecaca",textOnBackgroundColor:"#991b1b"}],[j.OrderStatusEnum.Error,{color:"#991b1b",backgroundColor:"#fca5a5",textOnBackgroundColor:"#7f1d1d"}]]),wi=n=>Hl.get(n)??vs,Wl=n=>{const e=wi(n);return{color:e.backgroundColor,textColor:e.textOnBackgroundColor,borderColor:e.color}},jl=n=>{const e=wi(n);return{"--sc-order-status-color":e.color,"--sc-order-status-bg":e.backgroundColor,"--sc-order-status-text":e.textOnBackgroundColor}},Ss=new Map([[rt.NotInStock,{color:"#ef4444",backgroundColor:"#f7ff00",textOnBackgroundColor:"#ff0000"}],[rt.OnOrder,{color:"#ca8a04",backgroundColor:"#f7ff00",textOnBackgroundColor:"#ff0000"}],[rt.LargeOrder,{color:"#ef2929",backgroundColor:"#ef2929",textOnBackgroundColor:"#ffffff"}],[rt.NextDayDelivery,{color:"#ef2929",backgroundColor:"#ef2929",textOnBackgroundColor:"#ffffff"}]]),ql=new Map([[rt.NotInStock,"Нет в наличии"],[rt.OnOrder,"Под заказ"],[rt.LargeOrder,"Крупный заказ"],[rt.NextDayDelivery,"Доставка на завтра"]]),so=[...Ss.keys()],Sr=n=>Ss.get(n)??vs,Bs=n=>ql.get(n)??n,Ns=n=>{const e=[];return n.isNotInStock&&e.push(rt.NotInStock),n.isOnOrder&&e.push(rt.OnOrder),n.isLargeOrder&&e.push(rt.LargeOrder),!M.isNil(n.delivery.date)&&xe.isTomorrow(new Date(n.delivery.date))&&e.push(rt.NextDayDelivery),e};var Me=(n=>(n.AttachedUser="attached_user",n.ClientInfo="client_info",n.ClientInfoShort="client_info_short",n.CreatedAt="created_at",n.ClientCity="client_city",n.DeliveryInfo="delivery_info",n.DeliveryDate="delivery_date",n.Id="id",n.PaymentType="payment_type",n.SalesDirections="sales_directions",n.Status="status",n.actions="actions",n))(Me||{}),je=(n=>(n.phone="phone",n.tablet="tablet",n.laptop="laptop",n))(je||{});const bt=class bt{static init(){bt.isInitialized||(bt.isInitialized=!0,bt.windowResizeHandler(),window.addEventListener("resize",bt.windowResizeHandler))}static destroy(){window.removeEventListener("resize",bt.windowResizeHandler),bt.isInitialized=!1}static getDeviceTypeByResolution(){const e=j.useBaseConfigStateStore().config.deviceTypeByResolution;return window.innerWidth<e.tablet?je.phone:window.innerWidth<e.laptop?je.tablet:je.laptop}static initRefDependingOnDeviceResolution(e,i,r){const o=t.ref(r);return bt.setRefValueDependingOnDeviceResolution(o,e,i,r),bt.refsDependingOnDeviceResolution.push({r:o,phoneValue:e,tabletValue:i,defaultValue:r}),o}static isPhoneDevice(){return bt.getDeviceTypeByResolution()===je.phone}static isTabletDevice(){return bt.getDeviceTypeByResolution()===je.tablet}static isLaptopDevice(){return bt.getDeviceTypeByResolution()===je.laptop}static setRefValueDependingOnDeviceResolution(e,i,r,o){switch(bt.getDeviceTypeByResolution()){case je.phone:e.value=i;break;case je.tablet:e.value=r;break;default:e.value=o;break}}static windowResizeHandler(){M.forEach(bt.refsDependingOnDeviceResolution,e=>{bt.setRefValueDependingOnDeviceResolution(e.r,e.phoneValue,e.tabletValue,e.defaultValue)})}};N(bt,"isInitialized",!1),N(bt,"refsDependingOnDeviceResolution",[]);let Xe=bt;function Xl(){try{return Xe.getDeviceTypeByResolution()}catch(n){return console.error(n),je.laptop}}function Rm(){const n=t.ref(Xl()),e=t.computed(()=>n.value===je.phone||n.value===je.tablet),i=()=>{n.value=Xl()};return t.onMounted(()=>{window.addEventListener("resize",i)}),t.onUnmounted(()=>{window.removeEventListener("resize",i)}),{isCompactLayout:e}}const Pm="(hover: hover) and (pointer: fine)",Yl=()=>{const n=M.isFunction(globalThis.matchMedia)?globalThis.matchMedia(Pm):void 0,e=t.ref(n?n.matches:!0),i=r=>{e.value=r.matches};return n==null||n.addEventListener("change",i),t.onScopeDispose(()=>{n==null||n.removeEventListener("change",i)},!0),t.readonly(e)},Fm=".sc-versions-list";function Vm(n,e,i){const r=document.querySelectorAll(Fm);if(r.length===0)return;const o=r[0],s=`${n}:`;if(M.some(o.querySelectorAll("li"),l=>M.startsWith(M.trim(l.textContent||""),s)))return;const a=document.createElement("li");a.append(document.createTextNode(`${s} ${e} от ${xe.format(i,"dd.MM.yyyy")}`)),o.append(a)}class xi{static isVnodeEmpty(e){return e.every(i=>i.type===t.Comment||i.type===t.Text&&M.isString(i.children)&&!i.children.trim()?!0:i.type===t.Fragment&&xi.isVnodeEmpty(i.children))}static hasSlotContent(e){return e?!xi.isVnodeEmpty(e()):!1}}const Mm={readAsFileData(n){return new Promise((e,i)=>{const r=new FileReader;r.addEventListener("load",()=>{e({name:n.name,content:r.result})}),r.addEventListener("error",()=>{i(new Error(`Не удалось прочитать файл «${n.name}».`))}),r.readAsDataURL(n)})}};class si{static isDeleted(e){return!!(e.deletedAt&&!xe.isFuture(e.deletedAt))}static getFormatEntityName(e){return si.isDeleted(e)?`${e.name} (Удалён)`:e.name}}const lt=(n,e=!1)=>{const{key:i}=n;if(!["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(i)&&!((n.ctrlKey||n.metaKey)&&["a","c","v","x","z","ф","с","м","ч","я"].includes(i.toLowerCase()))){if(e&&i==="-"){const r=n.target;if((r.selectionStart??0)===0&&!r.value.includes("-"))return}/^\d$/.test(i)||n.preventDefault()}},ao=(n,e=".",i=!1)=>{const{key:r}=n,o=n.target;["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(r)||(n.ctrlKey||n.metaKey)&&["a","c","v","x","z","ф","с","м","ч","я"].includes(r.toLowerCase())||i&&r==="-"&&!o.value.includes("-")&&((o.selectionStart??0)===0||o.value.length===0)||(r===e||r===(e==="."?",":"."))&&!o.value.includes(e)&&!o.value.includes(e==="."?",":".")||/^\d$/.test(r)||n.preventDefault()},ct=n=>n?Number.parseFloat(n.replace(",",".")):null,ot=(n,e)=>{n[e]={}},Le=n=>{const e=n.target;setTimeout(()=>{e.select()},100)};function Ul(n){return n.itemCount&&n.itemCount>0?`Всего ${n.itemCount} записей`:""}class _t{static convertReferencesToOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){let l=e.map(c=>({label:s?s(c):si.getFormatEntityName(c),value:c.id,item:c,disabled:a?a(c):!1}));return i&&(l=l.map(c=>`${c.label}-[${c.value}]`).sort().map(c=>l.find(d=>c===`${d.label}-[${d.value}]`))),r===!1?[...o?[{label:"",value:-1,disabled:!0}]:[],...l]:[...o?[{type:"group",label:"-",key:"default_group",children:[{label:"-- Отсутствует --",value:-1,disabled:!0}]}]:[],...Object.values(M.groupBy(l,r.key)).filter(c=>c.length>0).map(c=>{const d=c[0],u=M.isString(r.key)?M.get(d,r.key):r.key(c),f=M.isString(r.label)?M.get(d,r.label):r.label(c);return{type:"group",label:M.isEmpty(f)?"- Не определено -":f,key:`group_${u}`,children:c}})]}static convertReferencesToSelectOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){return _t.convertReferencesToOptionsList(e,i,r,o,s,a)}static convertReferencesToAutocompleteOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){return _t.convertReferencesToOptionsList(e,i,r,o,s,a)}}const Im={required:{required:!0,type:"any",trigger:["blur","input"],message:"Это поле обязательно для заполнения"}},le={required:{type:"number",required:!0,trigger:["blur","input"],message:"Это поле обязательно для заполнения"},min(n){return{type:"number",min:n,trigger:["blur","input"],message:`Минимальное значение: ${n}`}},max(n){return{type:"number",max:n,trigger:["blur","input"],message:`Максимальное значение: ${n}`}},step(n){return{type:"number",trigger:["blur","input"],validator:(e,i)=>i===null||Math.abs(i/n-Math.round(i/n))<1e-10?!0:new Error(`Значение должно быть кратно ${n}`)}}},Am={required:{required:!0,type:"date",trigger:["blur","input"],message:"Это поле обязательно для заполнения"}},He={serverValidation(n){return{validator:(e,i)=>i===null?!0:n?new Error(n):!0}}},Ts=n=>{var e;return((e=n.properties)==null?void 0:e.files)??[]},Kl=n=>{var e,i;return!!((e=n.properties)!=null&&e.description)||!!((i=n.properties)!=null&&i.specification)||Ts(n).length>0},Om={},zm=t.defineComponent({...Om,__name:"button-with-confirm-action",props:{disabled:{type:Boolean,default:!1},dialogTitle:{default:""},dialogContent:{default:""},disableConfirm:{type:Boolean,default:!1},popoverText:{default:""},type:{default:"default"},size:{default:"small"},quaternary:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},ghost:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["accept"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=()=>{r("accept",()=>{o.value=!1})},a=()=>{i.disableConfirm?s():o.value=!0};return(l,c)=>{const d=F.NButton,u=F.NPopover,f=F.NModal;return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(u,{disabled:n.popoverText.length===0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(d,{disabled:n.disabled,ghost:n.ghost,loading:n.loading,size:n.size,type:n.type,quaternary:n.quaternary,circle:n.circle,onClick:a},{default:t.withCtx(()=>[t.renderSlot(l.$slots,"default")]),_:3},8,["disabled","ghost","loading","size","type","quaternary","circle"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.popoverText),1)]),_:3},8,["disabled"]),t.createVNode(f,{show:o.value,"onUpdate:show":c[1]||(c[1]=h=>o.value=h),content:n.dialogContent,closable:!1,"mask-closable":!1,"show-icon":!1,title:n.dialogTitle,"action-class":"",preset:"dialog"},{action:t.withCtx(()=>[t.createVNode(d,{type:"primary",class:"px-8",onClick:s},{default:t.withCtx(()=>[...c[2]||(c[2]=[t.createTextVNode(" Да ",-1)])]),_:1}),t.createVNode(d,{type:"default",onClick:c[0]||(c[0]=h=>o.value=!1)},{default:t.withCtx(()=>[...c[3]||(c[3]=[t.createTextVNode(" Отмена ",-1)])]),_:1})]),_:1},8,["show","content","title"])])}}}),Dm={class:"flex gap-2 overflow-x-auto max-sm:flex-nowrap sm:flex-wrap sm:overflow-visible"},Lm={},Hm=t.defineComponent({...Lm,__name:"chip-group",props:{items:{},modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const i=e;return(r,o)=>(t.openBlock(),t.createElementBlock("div",Dm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,s=>(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:s.key,class:"shrink-0",round:"",size:"small",type:n.modelValue===s.key?"primary":"default",onClick:a=>i("update:modelValue",s.key)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.label),1)]),_:2},1032,["type","onClick"]))),128))]))}}),Wm={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function jm(n,e){return t.openBlock(),t.createElementBlock("svg",Wm,[...e[0]||(e[0]=[t.createElementVNode("circle",{cx:"256",cy:"256",r:"48",fill:"currentColor"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"416",r:"48",fill:"currentColor"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"96",r:"48",fill:"currentColor"},null,-1)])])}const $s=t.markRaw({name:"ion-ellipsis-vertical-sharp",render:jm}),qm={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xm(n,e){return t.openBlock(),t.createElementBlock("svg",qm,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M7 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-1"}),t.createElementVNode("path",{d:"M20.385 6.585a2.1 2.1 0 0 0-2.97-2.97L9 12v3h3zM16 5l3 3"})],-1)])])}const Gl=t.markRaw({name:"tabler-edit",render:Xm}),Ym={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Um(n,e){return t.openBlock(),t.createElementBlock("svg",Ym,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M258.9 48C141.92 46.42 46.42 141.92 48 258.9c1.56 112.19 92.91 203.54 205.1 205.1c117 1.6 212.48-93.9 210.88-210.88C462.44 140.91 371.09 49.56 258.9 48m-16.79 192.47l51.55-59a16 16 0 0 1 24.1 21.06l-51.55 59a16 16 0 1 1-24.1-21.06m-38.86 90.85a16 16 0 0 1-22.62 0l-47.95-48a16 16 0 1 1 22.64-22.62l48 48a16 16 0 0 1-.07 22.62m176.8-128.79l-111.88 128a16 16 0 0 1-11.51 5.47h-.54a16 16 0 0 1-11.32-4.69l-47.94-48a16 16 0 1 1 22.64-22.62l29.8 29.83a8 8 0 0 0 11.68-.39l95-108.66a16 16 0 0 1 24.1 21.06Z"},null,-1)])])}const Zl=t.markRaw({name:"ion-checkmark-done-circle",render:Um}),Km={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Gm(n,e){return t.openBlock(),t.createElementBlock("svg",Km,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 192L256.13 320l-47.95-48m-16.23 48L144 272m161.71-80l-51.55 59"},null,-1)])])}const Ql=t.markRaw({name:"ion-checkmark-done-circle-outline",render:Gm}),Zm={viewBox:"0 0 32 32",width:"1.2em",height:"1.2em"};function Qm(n,e){return t.openBlock(),t.createElementBlock("svg",Zm,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22.15 3.237c-1.93-1.93-5.185-1.403-6.406 1.04l-3.175 6.35a1.5 1.5 0 0 1-.868.752L6.72 13.04a2 2 0 0 0-.782 3.312l4.149 4.149L4 26.586v1.415h1.414l6.086-6.086l4.149 4.149a2 2 0 0 0 3.311-.782l1.661-4.983a1.5 1.5 0 0 1 .752-.867l6.351-3.175c2.442-1.222 2.97-4.476 1.04-6.407zM17.533 5.17a2 2 0 0 1 3.203-.52l6.614 6.614a2 2 0 0 1-.52 3.203l-6.351 3.175a3.5 3.5 0 0 0-1.755 2.024l-1.661 4.982l-9.712-9.711l4.983-1.661a3.5 3.5 0 0 0 2.024-1.755z"},null,-1)])])}const Jm=t.markRaw({name:"fluent-pin32-regular",render:Qm}),ep={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function tp(n,e){return t.openBlock(),t.createElementBlock("svg",ep,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"256",r:"80",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1)])])}const np=t.markRaw({name:"ion-eye-outline",render:tp}),ip={viewBox:"0 0 32 32",width:"1.2em",height:"1.2em"};function rp(n,e){return t.openBlock(),t.createElementBlock("svg",ip,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.744 4.276c1.221-2.442 4.476-2.97 6.406-1.04l6.614 6.614c1.93 1.93 1.402 5.186-1.04 6.406l-6.35 3.176a1.5 1.5 0 0 0-.753.867l-1.66 4.983a2 2 0 0 1-3.312.782l-4.149-4.15l-6.086 6.087H4v-1.415l6.086-6.085l-4.149-4.15a2 2 0 0 1 .782-3.31l4.982-1.662a1.5 1.5 0 0 0 .868-.752z"},null,-1)])])}const op=t.markRaw({name:"fluent-pin32-filled",render:rp}),sp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ap(n,e){return t.openBlock(),t.createElementBlock("svg",sp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M352 48H160a48 48 0 0 0-48 48v368l144-128l144 128V96a48 48 0 0 0-48-48"},null,-1)])])}const lp=t.markRaw({name:"ion-bookmark-outline",render:ap}),cp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function dp(n,e){return t.openBlock(),t.createElementBlock("svg",cp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m63.998 86.005l21.998-21.998L447.999 426.01l-21.998 21.998zM259.34 192.09l60.57 60.57a64.07 64.07 0 0 0-60.57-60.57m-6.68 127.82l-60.57-60.57a64.07 64.07 0 0 0 60.57 60.57"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M256 352a96 96 0 0 1-92.6-121.34l-69.07-69.08C66.12 187.42 39.24 221.14 16 256c26.42 44 62.56 89.24 100.2 115.18C159.38 400.92 206.33 416 255.76 416A233.5 233.5 0 0 0 335 402.2l-53.61-53.6A95.8 95.8 0 0 1 256 352m0-192a96 96 0 0 1 92.6 121.34L419.26 352c29.15-26.25 56.07-61.56 76.74-96c-26.38-43.43-62.9-88.56-101.18-114.82C351.1 111.2 304.31 96 255.76 96a222.9 222.9 0 0 0-78.21 14.29l53.11 53.11A95.8 95.8 0 0 1 256 160"},null,-1)])])}const up=t.markRaw({name:"ion-eye-off-sharp",render:dp}),fp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function hp(n,e){return t.openBlock(),t.createElementBlock("svg",fp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"m184 112l144 144l-144 144"},null,-1)])])}const mp=t.markRaw({name:"ion-chevron-forward-outline",render:hp}),pp=["data-name"],gp={class:"sc-collapse-item-header flex flex-row gap-2.5"},yp={class:"sc-collapse-item-arrow flex-none cursor-pointer pt-1.5"},bp={key:0},_p={class:"sc-collapse-item-pre-arrow flex flex-none flex-row gap-1"},wp={class:"flex flex-1 flex-col"},xp={key:0,class:"sc-collapse-item-sub-title flex-1"},kp={key:1,class:"sc-collapse-item-title-extra flex-none"},Cp={key:0,class:"sc-collapse-item-content"},vp={},Sp=t.defineComponent({...vp,__name:"collapse-item",props:{name:{default:""},title:{default:""},disabled:{type:Boolean,default:!1}},emits:["header:click"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.inject("itemHeaderClickHandler",M.noop),a=t.inject("defaultExpandedNames",[]),l=t.inject("expandedNames",[]),c=M.some(a,g=>g===r.name),d=t.computed(()=>M.some(l,g=>g===r.name)),u=t.ref(c),f=()=>{r.disabled||(u.value=d.value||!u.value,o("header:click",r.name,u.value),s(r.name,u.value))};return e({expand:()=>{!r.disabled&&!u.value&&(u.value=!0,o("header:click",r.name,u.value),s(r.name,u.value))},toggle:()=>{r.disabled||f()},collapse:()=>{!r.disabled&&u.value&&!d.value&&(u.value=!1,o("header:click",r.name,u.value),s(r.name,u.value))},expanded:t.readonly(u)}),(g,b)=>{const y=mp;return t.openBlock(),t.createElementBlock("div",{"data-name":n.name,class:t.normalizeClass([{"cursor-not-allowed text-gray-400":n.disabled},"sc-collapse-item flex flex-col p-2"])},[t.createElementVNode("div",gp,[t.createElementVNode("div",yp,[t.createElementVNode("div",{class:t.normalizeClass({"rotate-90":u.value}),onClick:f},[t.renderSlot(g.$slots,"arrow",{},()=>[t.createVNode(y)],!0)],2)]),t.unref(xi).hasSlotContent(g.$slots["pre-arrow"])?(t.openBlock(),t.createElementBlock("div",bp,[t.createElementVNode("div",_p,[t.renderSlot(g.$slots,"pre-arrow",{},void 0,!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",wp,[t.createElementVNode("div",{class:"sc-collapse-item-title flex flex-1 cursor-pointer flex-col text-lg font-semibold",onClick:f},[t.renderSlot(g.$slots,"header",{},()=>[t.createTextVNode(t.toDisplayString(n.title),1)],!0)]),t.unref(xi).hasSlotContent(g.$slots["sub-header"])?(t.openBlock(),t.createElementBlock("div",xp,[t.renderSlot(g.$slots,"sub-header",{},void 0,!0)])):t.createCommentVNode("",!0)]),t.unref(xi).hasSlotContent(g.$slots["header-extra"])?(t.openBlock(),t.createElementBlock("div",kp,[t.renderSlot(g.$slots,"header-extra",{},void 0,!0)])):t.createCommentVNode("",!0)]),t.createVNode(t.Transition,{name:"fade"},{default:t.withCtx(()=>[d.value||u.value?(t.openBlock(),t.createElementBlock("div",Cp,[t.renderSlot(g.$slots,"default",{},void 0,!0)])):t.createCommentVNode("",!0)]),_:3})],10,pp)}}}),fn=(n,e)=>{const i=n.__vccOpts||n;for(const[r,o]of e)i[r]=o;return i},Jl=fn(Sp,[["__scopeId","data-v-22a74c45"]]),Bp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Np(n,e){return t.openBlock(),t.createElementBlock("svg",Bp,[...e[0]||(e[0]=[t.createElementVNode("circle",{cx:"176",cy:"416",r:"16",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"400",cy:"416",r:"16",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M48 80h64l48 272h256"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M160 288h249.44a8 8 0 0 0 7.85-6.43l28.8-144a8 8 0 0 0-7.85-9.57H128"},null,-1)])])}const ec=t.markRaw({name:"ion-cart-outline",render:Np}),Br=Symbol(),Tp={Button:{border:"1px solid grey"},Card:{paddingMedium:"1rem"},Checkbox:{border:"1px solid rgb(12, 88, 32)"},Common:{borderRadius:"0.5rem",borderRadiusSmall:"0.25rem",fontWeight:"500",fontWeightStrong:"600",fontSize:"0.75rem",fontSizeMedium:"0.75rem",fontSizeLarge:"0.8125rem",lineHeight:"1.25rem",heightSmall:"24px",heightMedium:"30px",heightTiny:"20px",heightLarge:"36px",heightHuge:"42px",primaryColor:"#FFCC40FF",primaryColorHover:"#FFE49BFF",primaryColorPressed:"#FFBB00FF",primaryColorSuppl:"#FCC42AFF",successColor:"#4AC99BFF",successColorHover:"#4AC99BBF",successColorPressed:"#21AA78FF",errorColor:"#F45725FF",errorColorHover:"#F4572599",textColorBase:"#191C30E5",textColorDisabled:"#191C30E5"},DataTable:{borderColor:"rgb(207, 207, 207)",lineHeight:1.4,tdColorHover:"rgb(250,250,250)",thColor:"rgb(231, 231, 231)",thFontWeight:400,thPaddingMedium:"8px",tdPaddingMedium:"8px",thTextColor:"rgb(22, 0, 108)"},Drawer:{closeIconColor:"rgba(31, 34, 37, 1)",closeIconColorHover:"rgba(10, 157, 5, 1)"},Form:{marginBottom:0,lineHeight:1,labelFontSizeTopMedium:"0.75rem",labelHeightMedium:"20px",labelFontWeight:500,labelTextColor:"rgba(27, 31, 59, 0.65)",labelPaddingVertical:"0",labelPaddingHorizontal:"0"},Input:{paddingMedium:"0.5rem",fontSizeMedium:"0.9125rem",lineHeight:"1.25rem",lineHeightTextarea:"1.25rem",border:"1px solid #E0E0E0",borderRadius:"0.5rem",iconSize:"1,125rem"},Tabs:{tabFontSizeMedium:"0.9375rem",tabColorSegment:"#FFCC40FF",tabBorderColor:"#CCCCCCFF"}},$p={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},Ep={class:"inline-flex"},Rp={},tc=t.defineComponent({...Rp,__name:"product-actions",props:{eventEmitter:{},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0},product:{}},setup(n){const e=n,i=t.inject(Br,"medium"),r=Yl(),o=t.computed(()=>M.isFunction(e.showProductAddToCartButton)?e.showProductAddToCartButton(e.product):e.showProductAddToCartButton),s=t.computed(()=>M.isFunction(e.showProductEditButton)?e.showProductEditButton(e.product):e.showProductEditButton),a=t.computed(()=>M.isFunction(e.showProductRequiredButton)?e.showProductRequiredButton(e.product):e.showProductRequiredButton),l=t.computed(()=>a.value==="disabled"?`${ks}. ${kr}`:ks),c=t.computed(()=>M.isNil(e.productContextButtonsConfig)?[]:M.isFunction(e.productContextButtonsConfig)?e.productContextButtonsConfig(e.product):e.productContextButtonsConfig),d=()=>{e.eventEmitter.emit("product:add-to-cart",{product:e.product})},u=()=>{e.eventEmitter.emit("product:edit",{product:e.product})},f=()=>{e.eventEmitter.emit("product:required",{product:e.product})},h=p=>{e.eventEmitter.emit("product:context-select",{product:e.product,key:p})};return(p,m)=>{var w;const g=Ql,b=Zl,y=F.NButton,_=F.NTooltip,k=Gl,x=ec,v=$s,B=F.NDropdown;return t.openBlock(),t.createElementBlock("div",$p,[a.value?(t.openBlock(),t.createBlock(_,{key:0,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createElementVNode("span",Ep,[t.createVNode(y,{ghost:!0,size:t.unref(i),disabled:a.value==="disabled",type:n.product.isRequired?"primary":"default",onClick:f},{default:t.withCtx(()=>[n.product.isRequired?(t.openBlock(),t.createBlock(b,{key:1})):(t.openBlock(),t.createBlock(g,{key:0}))]),_:1},8,["size","disabled","type"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(l.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),s.value?(t.openBlock(),t.createBlock(_,{key:1,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),type:"primary",disabled:s.value==="disabled",onClick:u},{default:t.withCtx(()=>[t.createVNode(k)]),_:1},8,["size","disabled"])]),default:t.withCtx(()=>[m[0]||(m[0]=t.createTextVNode(" Редактировать ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createBlock(_,{key:2,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),disabled:o.value==="disabled",type:"primary",onClick:d},{default:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["size","disabled"])]),default:t.withCtx(()=>[m[1]||(m[1]=t.createTextVNode(" Добавить в корзину ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),((w=c.value)==null?void 0:w.length)>0?(t.openBlock(),t.createBlock(B,{key:3,options:c.value,size:t.unref(i),trigger:"click",onSelect:h},{default:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(v)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])}}}),Pp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fp(n,e){return t.openBlock(),t.createElementBlock("svg",Pp,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M12 8v4l2 2"}),t.createElementVNode("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})],-1)])])}const Vp=t.markRaw({name:"tabler-history",render:Fp}),Mp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ip(n,e){return t.openBlock(),t.createElementBlock("svg",Mp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m18.5 3.5l2 2l-15 15l-2-2zM7 4c1.66 0 3 1.34 3 3s-1.34 3-3 3s-3-1.34-3-3s1.34-3 3-3m10 10c1.66 0 3 1.34 3 3s-1.34 3-3 3s-3-1.34-3-3s1.34-3 3-3M7 6c-.55 0-1 .45-1 1s.45 1 1 1s1-.45 1-1s-.45-1-1-1m10 10c-.55 0-1 .45-1 1s.45 1 1 1s1-.45 1-1s-.45-1-1-1"},null,-1)])])}const Ap=t.markRaw({name:"mdi-percent-outline",render:Ip}),Op={class:"flex flex-row gap-1"},zp={key:0,class:"flex gap-1"},Dp={key:0,class:"flex text-nowrap text-sm line-through"},Lp={key:1,class:"flex flex-row text-nowrap text-sm"},Hp={key:2,class:"flex flex-row gap-1 text-nowrap text-sm text-gray-600"},Wp={},ai=t.defineComponent({...Wp,__name:"product-cost",props:{product:{},additionalThroughFieldName:{},costFieldName:{},eventEmitter:{},allowPriceClick:{type:[Boolean,Function],default:!1},showTag:{type:Boolean,default:!1},showQuantityUnit:{type:Boolean,default:!1},showCurrency:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},showPriceHistory:{type:Boolean,default:!1},currencyRates:{default:void 0}},setup(n){var k;const e=n,i=t.computed(()=>"product"in e.product),r=t.computed(()=>"discount"in e.product&&e.product.discount?si.getFormatEntityName(e.product.discount):""),o=t.computed(()=>"product"in e.product?e.product.product:e.product),s=t.computed(()=>M.isNil(u.value)?"":e.showQuantityUnit?M.compact([o.value.currency.symbol,o.value.unit.name]).join("/"):e.showCurrency?o.value.currency.symbol:""),a=t.computed(()=>e.showQuantityUnit?M.compact(["₽",o.value.unit.name]).join("/"):e.showCurrency?"₽":""),l=t.computed(()=>M.find(o.value.priceCoefficients,["coefficient.slug",e.costFieldName])),c=t.computed(()=>{const x=M.find(o.value.priceCoefficients,["coefficient.slug","k0"]);return l.value||!x||M.isNil(u.value)||M.isNil(x.cost)?!1:u.value<x.cost}),d=((k=j.useBaseConfigStateStore().getConfig())==null?void 0:k.defaultCurrency)??"RUB",u=t.computed(()=>l.value?l.value.cost:M.get(e.product,e.costFieldName)),f=t.computed(()=>e.additionalThroughFieldName?M.get(e.product,e.additionalThroughFieldName):void 0),h=t.computed(()=>o.value.costDate?xe.format(o.value.costDate,j.useBaseConfigStateStore().config.dateFormats.uiDate):void 0),p=t.computed(()=>e.currencyRates||o.value.currency.signature===d?e.currencyRates:{[o.value.currency.signature]:o.value.costRub/o.value.cost}),m=t.computed(()=>(M.isFunction(e.allowPriceClick)?e.allowPriceClick(o.value):e.allowPriceClick)&&!M.isNil(u.value)),g=t.computed(()=>M.isNil(u.value)?"-":new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(Number.parseFloat(u.value))),b=t.computed(()=>{if(o.value.currency.signature===d||!p.value||!p.value[o.value.currency.signature])return null;const x=p.value[o.value.currency.signature];return new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(Number.parseFloat(u.value)*x)}),y=t.computed(()=>M.isNil(f.value)?null:new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(f.value)),_=t.computed(()=>{if(!f.value||!u.value||f.value===u.value||u.value===0)return null;const x=(u.value-f.value)/f.value*100;return new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}).format(x)});return(x,v)=>{var $;const B=F.NTag,w=F.NTooltip,T=Ap,C=Vp;return t.openBlock(),t.createElementBlock("div",Op,[n.showTag?(t.openBlock(),t.createBlock(w,{key:0},{trigger:t.withCtx(()=>[t.createVNode(B,{round:"",bordered:!1,size:"small",class:t.normalizeClass(["text-slate-600",{"font-bold":!l.value}])},{default:t.withCtx(()=>{var E;return[t.createTextVNode(t.toDisplayString(((E=l.value)==null?void 0:E.coefficient.slug)??"Ц"),1)]}),_:1},8,["class"])]),default:t.withCtx(()=>{var E;return[t.createTextVNode(" "+t.toDisplayString(((E=l.value)==null?void 0:E.coefficient.name)??"Розничная цена"),1)]}),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass({"!text-red-600":c.value})},[f.value&&f.value!==u.value||_.value?(t.openBlock(),t.createElementBlock("div",zp,[f.value&&f.value!==u.value?(t.openBlock(),t.createElementBlock("span",Dp,t.toDisplayString(y.value)+" "+t.toDisplayString(s.value),1)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock("span",{key:1,class:t.normalizeClass(["flex text-nowrap text-sm text-gray-600",{"!text-red-600":c.value}])}," ("+t.toDisplayString(_.value)+"%) ",3)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass(["whitespace-nowrap text-base flex items-center gap-1",{"text-gray-600":($=l.value)==null?void 0:$.readOnly,"font-bold":!l.value&&!i.value}])},[t.createElementVNode("span",{class:t.normalizeClass({"text-nowrap":!0,"cursor-pointer underline decoration-dashed":m.value&&n.eventEmitter}),onClick:v[0]||(v[0]=()=>{var E;m.value&&((E=n.eventEmitter)==null||E.emit("cost:click",{product:o.value,cost:u.value}))})},t.toDisplayString(g.value),3),t.createTextVNode(" "+t.toDisplayString(s.value)+" ",1),u.value&&!l.value&&"discount"in n.product&&n.product.discount?(t.openBlock(),t.createBlock(w,{key:0},{trigger:t.withCtx(()=>[t.createVNode(T,{class:"text-sm text-black bg-amber-400 rounded p-px"})]),default:t.withCtx(()=>[t.createElementVNode("span",null,' На продукт действует скидка "'+t.toDisplayString(r.value)+'"; ',1)]),_:1})):t.createCommentVNode("",!0)],2),b.value?(t.openBlock(),t.createElementBlock("span",Lp," ~ "+t.toDisplayString(b.value)+" "+t.toDisplayString(a.value),1)):t.createCommentVNode("",!0),n.showCostDate&&!t.unref(M.isNil)(h.value)?(t.openBlock(),t.createElementBlock("span",Hp,[t.createTextVNode(t.toDisplayString(h.value)+" ",1),n.showPriceHistory&&n.eventEmitter?(t.openBlock(),t.createBlock(w,{key:0,placement:"top-end"},{trigger:t.withCtx(()=>[t.createVNode(C,{class:"cursor-pointer",onClick:v[1]||(v[1]=E=>{var I;return(I=n.eventEmitter)==null?void 0:I.emit("cost:show-price-history",{product:o.value})})})]),default:t.withCtx(()=>[v[2]||(v[2]=t.createTextVNode(" История цен ",-1))]),_:1})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],2)])}}}),jp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function qp(n,e){return t.openBlock(),t.createElementBlock("svg",jp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M248 64C146.39 64 64 146.39 64 248s82.39 184 184 184s184-82.39 184-184S349.61 64 248 64Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M220 220h32v116"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32",d:"M208 340h88"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M248 130a26 26 0 1 0 26 26a26 26 0 0 0-26-26"},null,-1)])])}const lo=t.markRaw({name:"ion-information-circle-outline",render:qp}),Xp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Yp(n,e){return t.openBlock(),t.createElementBlock("svg",Xp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M450.29 112H142c-34 0-62 27.51-62 61.33v245.34c0 33.82 28 61.33 62 61.33h308c34 0 62-26.18 62-60V173.33c0-33.82-27.68-61.33-61.71-61.33m-77.15 61.34a46 46 0 1 1-46.28 46a46.19 46.19 0 0 1 46.28-46.01Zm-231.55 276c-17 0-29.86-13.75-29.86-30.66v-64.83l90.46-80.79a46.54 46.54 0 0 1 63.44 1.83L328.27 337l-113 112.33ZM480 418.67a30.67 30.67 0 0 1-30.71 30.66H259L376.08 333a46.24 46.24 0 0 1 59.44-.16L480 370.59Z"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M384 32H64A64 64 0 0 0 0 96v256a64.11 64.11 0 0 0 48 62V152a72 72 0 0 1 72-72h326a64.11 64.11 0 0 0-62-48"},null,-1)])])}const nc=t.markRaw({name:"ion-images",render:Yp}),Up={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Kp(n,e){return t.openBlock(),t.createElementBlock("svg",Up,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M256 56C145.72 56 56 145.72 56 256s89.72 200 200 200s200-89.72 200-200S366.28 56 256 56m0 82a26 26 0 1 1-26 26a26 26 0 0 1 26-26m48 226h-88a16 16 0 0 1 0-32h28v-88h-16a16 16 0 0 1 0-32h32a16 16 0 0 1 16 16v104h28a16 16 0 0 1 0 32"},null,-1)])])}const Gp=t.markRaw({name:"ion-information-circle",render:Kp}),Zp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Qp(n,e){return t.openBlock(),t.createElementBlock("svg",Zp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M400 480a16 16 0 0 1-10.63-4L256 357.41L122.63 476A16 16 0 0 1 96 464V96a64.07 64.07 0 0 1 64-64h192a64.07 64.07 0 0 1 64 64v368a16 16 0 0 1-16 16"},null,-1)])])}const Jp=t.markRaw({name:"ion-bookmark",render:Qp});/*!
|
|
1
|
+
(function(X,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("@snabcentr/common-lib"),require("lodash-es"),require("date-fns"),require("vue"),require("naive-ui"),require("libphonenumber-js"),require("ts-case-convert"),require("vue-tel-input")):typeof define=="function"&&define.amd?define(["exports","@snabcentr/common-lib","lodash-es","date-fns","vue","naive-ui","libphonenumber-js","ts-case-convert","vue-tel-input"],j):(X=typeof globalThis<"u"?globalThis:X||self,j(X.SC_VueUiLib={},X["@snabcentr/common-lib"],X["lodash-es"],X["date-fns"],X.Vue,X["naive-ui"],X["libphonenumber-js"],X["ts-case-convert"],X["vue-tel-input"]))})(this,(function(X,j,M,xe,t,F,xr,xs,Sm){"use strict";var $T=Object.defineProperty;var xm=X=>{throw TypeError(X)};var ET=(X,j,M)=>j in X?$T(X,j,{enumerable:!0,configurable:!0,writable:!0,value:M}):X[j]=M;var N=(X,j,M)=>ET(X,typeof j!="symbol"?j+"":j,M),km=(X,j,M)=>j.has(X)||xm("Cannot "+M);var Dt=(X,j,M)=>(km(X,j,"read from private field"),M?M.call(X):j.get(X)),Il=(X,j,M)=>j.has(X)?xm("Cannot add the same private member more than once"):j instanceof WeakSet?j.add(X):j.set(X,M),Cm=(X,j,M,xe)=>(km(X,j,"write to private field"),xe?xe.call(X,M):j.set(X,M),M);var Li,xt,ys;const kr="Чтобы изменить, включите режим управления",ks="Товар, который нужно предлагать клиенту",Cs="Категория, которую нужно предлагать клиенту",Et=class Et{static init(e,i){Et.messagesService&&Et.notificationsService||(Et.messagesService=e,Et.notificationsService=i)}static getMessagesService(){if(!Et.messagesService)throw new Error("UI provider is not initialized.");return Et.messagesService}static getNotificationsService(){if(!Et.notificationsService)throw new Error("UI provider is not initialized.");return Et.notificationsService}static showNotificationsForErrorResponseData(e,i={}){var r,o;if(M.isEmpty(e.errors)){const s=(o=(r=e.rawError)==null?void 0:r.config)==null?void 0:o.url,a=s?` [ ${s} ]`:"";Et.notificationsService?Et.notificationsService.error({title:"Ошибка выполнения/обработки запроса",content:e.message,meta:`#${e.status}${a}: ${e.statusText}`,duration:3e3}):console.log("Show notification error response data: UI provider is not initialized.",e)}else for(const s in e.errors)Object.prototype.hasOwnProperty.call(i,s)?i[s]=new j.FieldValidationResultData(e.errors[s].toString(),"error"):Et.messagesService?Et.messagesService.error(e.errors[s].toString()):console.log("Show notification error response data: UI provider is not initialized.",e.errors[s])}};N(Et,"messagesService"),N(Et,"notificationsService");let Cr=Et;const vr=new WeakMap,Bm=async n=>{const e=navigator.clipboard;if(e!=null&&e.writeText){await e.writeText(n);return}const i=document.createElement("textarea");i.value=n,i.style.position="fixed",i.style.opacity="0",document.body.append(i),i.select();const r=document.execCommand("copy");if(i.remove(),!r)throw new Error("Не удалось скопировать через execCommand.")},Ol=async n=>{const e=M.isNil(n)?"":String(n);if(e)try{await Bm(e),Cr.getNotificationsService().success({title:"Готово",description:`Скопировано в буфер обмена: ${e}`,duration:2e3})}catch{Cr.getNotificationsService().error({title:"Ошибка",description:"Не удалось скопировать в буфер обмена.",duration:3e3})}},Nm=n=>n.tagName==="BUTTON"||n.getAttribute("role")==="button"||!!n.closest("button"),Tm=(n,e)=>e.modifiers.click?"click":e.modifiers.dblclick?"dblclick":Nm(n)?"click":"dblclick",zl={mounted(n,e){n.style.setProperty("cursor","pointer");const i=Tm(n,e),r=o=>{var a;i==="dblclick"&&(o.preventDefault(),(a=globalThis.getSelection())==null||a.removeAllRanges());const s=vr.get(n);Ol(s==null?void 0:s.value).catch(M.noop)};vr.set(n,{value:e.value,eventName:i,handler:r}),n.addEventListener(i,r)},updated(n,e){const i=vr.get(n);i&&(i.value=e.value)},beforeUnmount(n){const e=vr.get(n);e&&(n.removeEventListener(e.eventName,e.handler),vr.delete(n))}},$m=new Set(["checkbox","radio","range","button","submit","reset","file","color","image","hidden"]),Em=".n-base-selection, .n-date-picker, .n-time-picker, .n-color-picker",oo=new WeakMap,Dl=n=>!$m.has(n.type)&&!n.disabled&&!n.readOnly&&n.closest(Em)===null&&n.getClientRects().length>0,Ll=n=>{var a;if(n.key!=="Enter"&&n.code!=="Enter"||n.shiftKey||n.isComposing)return;const{target:e}=n;if(!(e instanceof HTMLInputElement)||!Dl(e))return;n.preventDefault();const i=n.currentTarget,r=[...i.querySelectorAll("input")].filter(l=>Dl(l)),o=r.indexOf(e);if(o===-1)return;const s=r.at(o+1);if(s){s.focus(),s.select();return}(a=oo.get(i))==null||a()},oi={mounted(n,e){oo.set(n,e.value),n.addEventListener("keydown",Ll)},updated(n,e){oo.set(n,e.value)},unmounted(n){n.removeEventListener("keydown",Ll),oo.delete(n)}};var rt=(n=>(n.NotInStock="not_in_stock",n.OnOrder="on_order",n.LargeOrder="large_order",n.NextDayDelivery="next_day_delivery",n))(rt||{});const vs={color:"#4b5563",backgroundColor:"#e5e7eb",textOnBackgroundColor:"#1f2937"},Hl=new Map([[j.OrderStatusEnum.New,{color:"#15803d",backgroundColor:"#bbf7d0",textOnBackgroundColor:"#166534"}],[j.OrderStatusEnum.Processing,{color:"#ea580c",backgroundColor:"#fed7aa",textOnBackgroundColor:"#9a3412"}],[j.OrderStatusEnum.AwaitingSupplyProducts,{color:"#ca8a04",backgroundColor:"#fef08a",textOnBackgroundColor:"#854d0e"}],[j.OrderStatusEnum.InvoiceIssued,{color:"#1d4ed8",backgroundColor:"#bfdbfe",textOnBackgroundColor:"#1e40af"}],[j.OrderStatusEnum.ProcessingOnStock,{color:"#0e7490",backgroundColor:"#a5f3fc",textOnBackgroundColor:"#155e75"}],[j.OrderStatusEnum.OrderUpdated,{color:"#6d28d9",backgroundColor:"#ddd6fe",textOnBackgroundColor:"#5b21b6"}],[j.OrderStatusEnum.Finished,{color:"#475569",backgroundColor:"#e2e8f0",textOnBackgroundColor:"#1e293b"}],[j.OrderStatusEnum.Canceled,{color:"#b91c1c",backgroundColor:"#fecaca",textOnBackgroundColor:"#991b1b"}],[j.OrderStatusEnum.Error,{color:"#991b1b",backgroundColor:"#fca5a5",textOnBackgroundColor:"#7f1d1d"}]]),wi=n=>Hl.get(n)??vs,Wl=n=>{const e=wi(n);return{color:e.backgroundColor,textColor:e.textOnBackgroundColor,borderColor:e.color}},jl=n=>{const e=wi(n);return{"--sc-order-status-color":e.color,"--sc-order-status-bg":e.backgroundColor,"--sc-order-status-text":e.textOnBackgroundColor}},Ss=new Map([[rt.NotInStock,{color:"#ef4444",backgroundColor:"#f7ff00",textOnBackgroundColor:"#ff0000"}],[rt.OnOrder,{color:"#ca8a04",backgroundColor:"#f7ff00",textOnBackgroundColor:"#ff0000"}],[rt.LargeOrder,{color:"#ef2929",backgroundColor:"#ef2929",textOnBackgroundColor:"#ffffff"}],[rt.NextDayDelivery,{color:"#ef2929",backgroundColor:"#ef2929",textOnBackgroundColor:"#ffffff"}]]),ql=new Map([[rt.NotInStock,"Нет в наличии"],[rt.OnOrder,"Под заказ"],[rt.LargeOrder,"Крупный заказ"],[rt.NextDayDelivery,"Доставка на завтра"]]),so=[...Ss.keys()],Sr=n=>Ss.get(n)??vs,Bs=n=>ql.get(n)??n,Ns=n=>{const e=[];return n.isNotInStock&&e.push(rt.NotInStock),n.isOnOrder&&e.push(rt.OnOrder),n.isLargeOrder&&e.push(rt.LargeOrder),!M.isNil(n.delivery.date)&&xe.isTomorrow(new Date(n.delivery.date))&&e.push(rt.NextDayDelivery),e};var Me=(n=>(n.AttachedUser="attached_user",n.ClientInfo="client_info",n.ClientInfoShort="client_info_short",n.CreatedAt="created_at",n.ClientCity="client_city",n.DeliveryInfo="delivery_info",n.DeliveryDate="delivery_date",n.Id="id",n.PaymentType="payment_type",n.SalesDirections="sales_directions",n.Status="status",n.actions="actions",n))(Me||{}),je=(n=>(n.phone="phone",n.tablet="tablet",n.laptop="laptop",n))(je||{});const _t=class _t{static init(){_t.isInitialized||(_t.isInitialized=!0,_t.windowResizeHandler(),window.addEventListener("resize",_t.windowResizeHandler))}static destroy(){window.removeEventListener("resize",_t.windowResizeHandler),_t.isInitialized=!1}static getDeviceTypeByResolution(){const e=j.useBaseConfigStateStore().config.deviceTypeByResolution;return window.innerWidth<e.tablet?je.phone:window.innerWidth<e.laptop?je.tablet:je.laptop}static initRefDependingOnDeviceResolution(e,i,r){const o=t.ref(r);return _t.setRefValueDependingOnDeviceResolution(o,e,i,r),_t.refsDependingOnDeviceResolution.push({r:o,phoneValue:e,tabletValue:i,defaultValue:r}),o}static isPhoneDevice(){return _t.getDeviceTypeByResolution()===je.phone}static isTabletDevice(){return _t.getDeviceTypeByResolution()===je.tablet}static isLaptopDevice(){return _t.getDeviceTypeByResolution()===je.laptop}static setRefValueDependingOnDeviceResolution(e,i,r,o){switch(_t.getDeviceTypeByResolution()){case je.phone:e.value=i;break;case je.tablet:e.value=r;break;default:e.value=o;break}}static windowResizeHandler(){M.forEach(_t.refsDependingOnDeviceResolution,e=>{_t.setRefValueDependingOnDeviceResolution(e.r,e.phoneValue,e.tabletValue,e.defaultValue)})}};N(_t,"isInitialized",!1),N(_t,"refsDependingOnDeviceResolution",[]);let Xe=_t;function Xl(){try{return Xe.getDeviceTypeByResolution()}catch(n){return console.error(n),je.laptop}}function Rm(){const n=t.ref(Xl()),e=t.computed(()=>n.value===je.phone||n.value===je.tablet),i=()=>{n.value=Xl()};return t.onMounted(()=>{window.addEventListener("resize",i)}),t.onUnmounted(()=>{window.removeEventListener("resize",i)}),{isCompactLayout:e}}const Pm="(hover: hover) and (pointer: fine)",Yl=()=>{const n=M.isFunction(globalThis.matchMedia)?globalThis.matchMedia(Pm):void 0,e=t.ref(n?n.matches:!0),i=r=>{e.value=r.matches};return n==null||n.addEventListener("change",i),t.onScopeDispose(()=>{n==null||n.removeEventListener("change",i)},!0),t.readonly(e)},Fm=".sc-versions-list";function Vm(n,e,i){const r=document.querySelectorAll(Fm);if(r.length===0)return;const o=r[0],s=`${n}:`;if(M.some(o.querySelectorAll("li"),l=>M.startsWith(M.trim(l.textContent||""),s)))return;const a=document.createElement("li");a.append(document.createTextNode(`${s} ${e} от ${xe.format(i,"dd.MM.yyyy")}`)),o.append(a)}class xi{static isVnodeEmpty(e){return e.every(i=>i.type===t.Comment||i.type===t.Text&&M.isString(i.children)&&!i.children.trim()?!0:i.type===t.Fragment&&xi.isVnodeEmpty(i.children))}static hasSlotContent(e){return e?!xi.isVnodeEmpty(e()):!1}}const Mm={readAsFileData(n){return new Promise((e,i)=>{const r=new FileReader;r.addEventListener("load",()=>{e({name:n.name,content:r.result})}),r.addEventListener("error",()=>{i(new Error(`Не удалось прочитать файл «${n.name}».`))}),r.readAsDataURL(n)})}};class si{static isDeleted(e){return!!(e.deletedAt&&!xe.isFuture(e.deletedAt))}static getFormatEntityName(e){return si.isDeleted(e)?`${e.name} (Удалён)`:e.name}}const lt=(n,e=!1)=>{const{key:i}=n;if(!["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(i)&&!((n.ctrlKey||n.metaKey)&&["a","c","v","x","z","ф","с","м","ч","я"].includes(i.toLowerCase()))){if(e&&i==="-"){const r=n.target;if((r.selectionStart??0)===0&&!r.value.includes("-"))return}/^\d$/.test(i)||n.preventDefault()}},ao=(n,e=".",i=!1)=>{const{key:r}=n,o=n.target;["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(r)||(n.ctrlKey||n.metaKey)&&["a","c","v","x","z","ф","с","м","ч","я"].includes(r.toLowerCase())||i&&r==="-"&&!o.value.includes("-")&&((o.selectionStart??0)===0||o.value.length===0)||(r===e||r===(e==="."?",":"."))&&!o.value.includes(e)&&!o.value.includes(e==="."?",":".")||/^\d$/.test(r)||n.preventDefault()},ct=n=>n?Number.parseFloat(n.replace(",",".")):null,ot=(n,e)=>{n[e]={}},Le=n=>{const e=n.target;setTimeout(()=>{e.select()},100)};function Ul(n){return n.itemCount&&n.itemCount>0?`Всего ${n.itemCount} записей`:""}class gt{static convertReferencesToOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){let l=e.map(c=>({label:s?s(c):si.getFormatEntityName(c),value:c.id,item:c,disabled:a?a(c):!1}));return i&&(l=l.map(c=>`${c.label}-[${c.value}]`).sort().map(c=>l.find(d=>c===`${d.label}-[${d.value}]`))),r===!1?[...o?[{label:"",value:-1,disabled:!0}]:[],...l]:[...o?[{type:"group",label:"-",key:"default_group",children:[{label:"-- Отсутствует --",value:-1,disabled:!0}]}]:[],...Object.values(M.groupBy(l,r.key)).filter(c=>c.length>0).map(c=>{const d=c[0],u=M.isString(r.key)?M.get(d,r.key):r.key(c),f=M.isString(r.label)?M.get(d,r.label):r.label(c);return{type:"group",label:M.isEmpty(f)?"- Не определено -":f,key:`group_${u}`,children:c}})]}static convertReferencesToSelectOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){return gt.convertReferencesToOptionsList(e,i,r,o,s,a)}static convertReferencesToAutocompleteOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){return gt.convertReferencesToOptionsList(e,i,r,o,s,a)}}const Im={required:{required:!0,type:"any",trigger:["blur","input"],message:"Это поле обязательно для заполнения"}},le={required:{type:"number",required:!0,trigger:["blur","input"],message:"Это поле обязательно для заполнения"},min(n){return{type:"number",min:n,trigger:["blur","input"],message:`Минимальное значение: ${n}`}},max(n){return{type:"number",max:n,trigger:["blur","input"],message:`Максимальное значение: ${n}`}},step(n){return{type:"number",trigger:["blur","input"],validator:(e,i)=>i===null||Math.abs(i/n-Math.round(i/n))<1e-10?!0:new Error(`Значение должно быть кратно ${n}`)}}},Am={required:{required:!0,type:"date",trigger:["blur","input"],message:"Это поле обязательно для заполнения"}},He={serverValidation(n){return{validator:(e,i)=>i===null?!0:n?new Error(n):!0}}},Ts=n=>{var e;return((e=n.properties)==null?void 0:e.files)??[]},Kl=n=>{var e,i;return!!((e=n.properties)!=null&&e.description)||!!((i=n.properties)!=null&&i.specification)||Ts(n).length>0},Om={},zm=t.defineComponent({...Om,__name:"button-with-confirm-action",props:{disabled:{type:Boolean,default:!1},dialogTitle:{default:""},dialogContent:{default:""},disableConfirm:{type:Boolean,default:!1},popoverText:{default:""},type:{default:"default"},size:{default:"small"},quaternary:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},ghost:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["accept"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=()=>{r("accept",()=>{o.value=!1})},a=()=>{i.disableConfirm?s():o.value=!0};return(l,c)=>{const d=F.NButton,u=F.NPopover,f=F.NModal;return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(u,{disabled:n.popoverText.length===0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(d,{disabled:n.disabled,ghost:n.ghost,loading:n.loading,size:n.size,type:n.type,quaternary:n.quaternary,circle:n.circle,onClick:a},{default:t.withCtx(()=>[t.renderSlot(l.$slots,"default")]),_:3},8,["disabled","ghost","loading","size","type","quaternary","circle"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.popoverText),1)]),_:3},8,["disabled"]),t.createVNode(f,{show:o.value,"onUpdate:show":c[1]||(c[1]=h=>o.value=h),content:n.dialogContent,closable:!1,"mask-closable":!1,"show-icon":!1,title:n.dialogTitle,"action-class":"",preset:"dialog"},{action:t.withCtx(()=>[t.createVNode(d,{type:"primary",class:"px-8",onClick:s},{default:t.withCtx(()=>[...c[2]||(c[2]=[t.createTextVNode(" Да ",-1)])]),_:1}),t.createVNode(d,{type:"default",onClick:c[0]||(c[0]=h=>o.value=!1)},{default:t.withCtx(()=>[...c[3]||(c[3]=[t.createTextVNode(" Отмена ",-1)])]),_:1})]),_:1},8,["show","content","title"])])}}}),Dm={class:"flex gap-2 overflow-x-auto max-sm:flex-nowrap sm:flex-wrap sm:overflow-visible"},Lm={},Hm=t.defineComponent({...Lm,__name:"chip-group",props:{items:{},modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const i=e;return(r,o)=>(t.openBlock(),t.createElementBlock("div",Dm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,s=>(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:s.key,class:"shrink-0",round:"",size:"small",type:n.modelValue===s.key?"primary":"default",onClick:a=>i("update:modelValue",s.key)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.label),1)]),_:2},1032,["type","onClick"]))),128))]))}}),Wm={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function jm(n,e){return t.openBlock(),t.createElementBlock("svg",Wm,[...e[0]||(e[0]=[t.createElementVNode("circle",{cx:"256",cy:"256",r:"48",fill:"currentColor"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"416",r:"48",fill:"currentColor"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"96",r:"48",fill:"currentColor"},null,-1)])])}const $s=t.markRaw({name:"ion-ellipsis-vertical-sharp",render:jm}),qm={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xm(n,e){return t.openBlock(),t.createElementBlock("svg",qm,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M7 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-1"}),t.createElementVNode("path",{d:"M20.385 6.585a2.1 2.1 0 0 0-2.97-2.97L9 12v3h3zM16 5l3 3"})],-1)])])}const Gl=t.markRaw({name:"tabler-edit",render:Xm}),Ym={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Um(n,e){return t.openBlock(),t.createElementBlock("svg",Ym,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M258.9 48C141.92 46.42 46.42 141.92 48 258.9c1.56 112.19 92.91 203.54 205.1 205.1c117 1.6 212.48-93.9 210.88-210.88C462.44 140.91 371.09 49.56 258.9 48m-16.79 192.47l51.55-59a16 16 0 0 1 24.1 21.06l-51.55 59a16 16 0 1 1-24.1-21.06m-38.86 90.85a16 16 0 0 1-22.62 0l-47.95-48a16 16 0 1 1 22.64-22.62l48 48a16 16 0 0 1-.07 22.62m176.8-128.79l-111.88 128a16 16 0 0 1-11.51 5.47h-.54a16 16 0 0 1-11.32-4.69l-47.94-48a16 16 0 1 1 22.64-22.62l29.8 29.83a8 8 0 0 0 11.68-.39l95-108.66a16 16 0 0 1 24.1 21.06Z"},null,-1)])])}const Zl=t.markRaw({name:"ion-checkmark-done-circle",render:Um}),Km={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Gm(n,e){return t.openBlock(),t.createElementBlock("svg",Km,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 192L256.13 320l-47.95-48m-16.23 48L144 272m161.71-80l-51.55 59"},null,-1)])])}const Ql=t.markRaw({name:"ion-checkmark-done-circle-outline",render:Gm}),Zm={viewBox:"0 0 32 32",width:"1.2em",height:"1.2em"};function Qm(n,e){return t.openBlock(),t.createElementBlock("svg",Zm,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22.15 3.237c-1.93-1.93-5.185-1.403-6.406 1.04l-3.175 6.35a1.5 1.5 0 0 1-.868.752L6.72 13.04a2 2 0 0 0-.782 3.312l4.149 4.149L4 26.586v1.415h1.414l6.086-6.086l4.149 4.149a2 2 0 0 0 3.311-.782l1.661-4.983a1.5 1.5 0 0 1 .752-.867l6.351-3.175c2.442-1.222 2.97-4.476 1.04-6.407zM17.533 5.17a2 2 0 0 1 3.203-.52l6.614 6.614a2 2 0 0 1-.52 3.203l-6.351 3.175a3.5 3.5 0 0 0-1.755 2.024l-1.661 4.982l-9.712-9.711l4.983-1.661a3.5 3.5 0 0 0 2.024-1.755z"},null,-1)])])}const Jm=t.markRaw({name:"fluent-pin32-regular",render:Qm}),ep={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function tp(n,e){return t.openBlock(),t.createElementBlock("svg",ep,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"256",r:"80",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1)])])}const np=t.markRaw({name:"ion-eye-outline",render:tp}),ip={viewBox:"0 0 32 32",width:"1.2em",height:"1.2em"};function rp(n,e){return t.openBlock(),t.createElementBlock("svg",ip,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.744 4.276c1.221-2.442 4.476-2.97 6.406-1.04l6.614 6.614c1.93 1.93 1.402 5.186-1.04 6.406l-6.35 3.176a1.5 1.5 0 0 0-.753.867l-1.66 4.983a2 2 0 0 1-3.312.782l-4.149-4.15l-6.086 6.087H4v-1.415l6.086-6.085l-4.149-4.15a2 2 0 0 1 .782-3.31l4.982-1.662a1.5 1.5 0 0 0 .868-.752z"},null,-1)])])}const op=t.markRaw({name:"fluent-pin32-filled",render:rp}),sp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ap(n,e){return t.openBlock(),t.createElementBlock("svg",sp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M352 48H160a48 48 0 0 0-48 48v368l144-128l144 128V96a48 48 0 0 0-48-48"},null,-1)])])}const lp=t.markRaw({name:"ion-bookmark-outline",render:ap}),cp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function dp(n,e){return t.openBlock(),t.createElementBlock("svg",cp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m63.998 86.005l21.998-21.998L447.999 426.01l-21.998 21.998zM259.34 192.09l60.57 60.57a64.07 64.07 0 0 0-60.57-60.57m-6.68 127.82l-60.57-60.57a64.07 64.07 0 0 0 60.57 60.57"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M256 352a96 96 0 0 1-92.6-121.34l-69.07-69.08C66.12 187.42 39.24 221.14 16 256c26.42 44 62.56 89.24 100.2 115.18C159.38 400.92 206.33 416 255.76 416A233.5 233.5 0 0 0 335 402.2l-53.61-53.6A95.8 95.8 0 0 1 256 352m0-192a96 96 0 0 1 92.6 121.34L419.26 352c29.15-26.25 56.07-61.56 76.74-96c-26.38-43.43-62.9-88.56-101.18-114.82C351.1 111.2 304.31 96 255.76 96a222.9 222.9 0 0 0-78.21 14.29l53.11 53.11A95.8 95.8 0 0 1 256 160"},null,-1)])])}const up=t.markRaw({name:"ion-eye-off-sharp",render:dp}),fp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function hp(n,e){return t.openBlock(),t.createElementBlock("svg",fp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"m184 112l144 144l-144 144"},null,-1)])])}const mp=t.markRaw({name:"ion-chevron-forward-outline",render:hp}),pp=["data-name"],gp={class:"sc-collapse-item-header flex flex-row gap-2.5"},yp={class:"sc-collapse-item-arrow flex-none cursor-pointer pt-1.5"},bp={key:0},_p={class:"sc-collapse-item-pre-arrow flex flex-none flex-row gap-1"},wp={class:"flex flex-1 flex-col"},xp={key:0,class:"sc-collapse-item-sub-title flex-1"},kp={key:1,class:"sc-collapse-item-title-extra flex-none"},Cp={key:0,class:"sc-collapse-item-content"},vp={},Sp=t.defineComponent({...vp,__name:"collapse-item",props:{name:{default:""},title:{default:""},disabled:{type:Boolean,default:!1}},emits:["header:click"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.inject("itemHeaderClickHandler",M.noop),a=t.inject("defaultExpandedNames",[]),l=t.inject("expandedNames",[]),c=M.some(a,g=>g===r.name),d=t.computed(()=>M.some(l,g=>g===r.name)),u=t.ref(c),f=()=>{r.disabled||(u.value=d.value||!u.value,o("header:click",r.name,u.value),s(r.name,u.value))};return e({expand:()=>{!r.disabled&&!u.value&&(u.value=!0,o("header:click",r.name,u.value),s(r.name,u.value))},toggle:()=>{r.disabled||f()},collapse:()=>{!r.disabled&&u.value&&!d.value&&(u.value=!1,o("header:click",r.name,u.value),s(r.name,u.value))},expanded:t.readonly(u)}),(g,b)=>{const y=mp;return t.openBlock(),t.createElementBlock("div",{"data-name":n.name,class:t.normalizeClass([{"cursor-not-allowed text-gray-400":n.disabled},"sc-collapse-item flex flex-col p-2"])},[t.createElementVNode("div",gp,[t.createElementVNode("div",yp,[t.createElementVNode("div",{class:t.normalizeClass({"rotate-90":u.value}),onClick:f},[t.renderSlot(g.$slots,"arrow",{},()=>[t.createVNode(y)],!0)],2)]),t.unref(xi).hasSlotContent(g.$slots["pre-arrow"])?(t.openBlock(),t.createElementBlock("div",bp,[t.createElementVNode("div",_p,[t.renderSlot(g.$slots,"pre-arrow",{},void 0,!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",wp,[t.createElementVNode("div",{class:"sc-collapse-item-title flex flex-1 cursor-pointer flex-col text-lg font-semibold",onClick:f},[t.renderSlot(g.$slots,"header",{},()=>[t.createTextVNode(t.toDisplayString(n.title),1)],!0)]),t.unref(xi).hasSlotContent(g.$slots["sub-header"])?(t.openBlock(),t.createElementBlock("div",xp,[t.renderSlot(g.$slots,"sub-header",{},void 0,!0)])):t.createCommentVNode("",!0)]),t.unref(xi).hasSlotContent(g.$slots["header-extra"])?(t.openBlock(),t.createElementBlock("div",kp,[t.renderSlot(g.$slots,"header-extra",{},void 0,!0)])):t.createCommentVNode("",!0)]),t.createVNode(t.Transition,{name:"fade"},{default:t.withCtx(()=>[d.value||u.value?(t.openBlock(),t.createElementBlock("div",Cp,[t.renderSlot(g.$slots,"default",{},void 0,!0)])):t.createCommentVNode("",!0)]),_:3})],10,pp)}}}),fn=(n,e)=>{const i=n.__vccOpts||n;for(const[r,o]of e)i[r]=o;return i},Jl=fn(Sp,[["__scopeId","data-v-22a74c45"]]),Bp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Np(n,e){return t.openBlock(),t.createElementBlock("svg",Bp,[...e[0]||(e[0]=[t.createElementVNode("circle",{cx:"176",cy:"416",r:"16",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"400",cy:"416",r:"16",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M48 80h64l48 272h256"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M160 288h249.44a8 8 0 0 0 7.85-6.43l28.8-144a8 8 0 0 0-7.85-9.57H128"},null,-1)])])}const ec=t.markRaw({name:"ion-cart-outline",render:Np}),Br=Symbol(),Tp={Button:{border:"1px solid grey"},Card:{paddingMedium:"1rem"},Checkbox:{border:"1px solid rgb(12, 88, 32)"},Common:{borderRadius:"0.5rem",borderRadiusSmall:"0.25rem",fontWeight:"500",fontWeightStrong:"600",fontSize:"0.75rem",fontSizeMedium:"0.75rem",fontSizeLarge:"0.8125rem",lineHeight:"1.25rem",heightSmall:"24px",heightMedium:"30px",heightTiny:"20px",heightLarge:"36px",heightHuge:"42px",primaryColor:"#FFCC40FF",primaryColorHover:"#FFE49BFF",primaryColorPressed:"#FFBB00FF",primaryColorSuppl:"#FCC42AFF",successColor:"#4AC99BFF",successColorHover:"#4AC99BBF",successColorPressed:"#21AA78FF",errorColor:"#F45725FF",errorColorHover:"#F4572599",textColorBase:"#191C30E5",textColorDisabled:"#191C30E5"},DataTable:{borderColor:"rgb(207, 207, 207)",lineHeight:1.4,tdColorHover:"rgb(250,250,250)",thColor:"rgb(231, 231, 231)",thFontWeight:400,thPaddingMedium:"8px",tdPaddingMedium:"8px",thTextColor:"rgb(22, 0, 108)"},Drawer:{closeIconColor:"rgba(31, 34, 37, 1)",closeIconColorHover:"rgba(10, 157, 5, 1)"},Form:{marginBottom:0,lineHeight:1,labelFontSizeTopMedium:"0.75rem",labelHeightMedium:"20px",labelFontWeight:500,labelTextColor:"rgba(27, 31, 59, 0.65)",labelPaddingVertical:"0",labelPaddingHorizontal:"0"},Input:{paddingMedium:"0.5rem",fontSizeMedium:"0.9125rem",lineHeight:"1.25rem",lineHeightTextarea:"1.25rem",border:"1px solid #E0E0E0",borderRadius:"0.5rem",iconSize:"1,125rem"},Tabs:{tabFontSizeMedium:"0.9375rem",tabColorSegment:"#FFCC40FF",tabBorderColor:"#CCCCCCFF"}},$p={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},Ep={class:"inline-flex"},Rp={},tc=t.defineComponent({...Rp,__name:"product-actions",props:{eventEmitter:{},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0},product:{}},setup(n){const e=n,i=t.inject(Br,"medium"),r=Yl(),o=t.computed(()=>M.isFunction(e.showProductAddToCartButton)?e.showProductAddToCartButton(e.product):e.showProductAddToCartButton),s=t.computed(()=>M.isFunction(e.showProductEditButton)?e.showProductEditButton(e.product):e.showProductEditButton),a=t.computed(()=>M.isFunction(e.showProductRequiredButton)?e.showProductRequiredButton(e.product):e.showProductRequiredButton),l=t.computed(()=>a.value==="disabled"?`${ks}. ${kr}`:ks),c=t.computed(()=>M.isNil(e.productContextButtonsConfig)?[]:M.isFunction(e.productContextButtonsConfig)?e.productContextButtonsConfig(e.product):e.productContextButtonsConfig),d=()=>{e.eventEmitter.emit("product:add-to-cart",{product:e.product})},u=()=>{e.eventEmitter.emit("product:edit",{product:e.product})},f=()=>{e.eventEmitter.emit("product:required",{product:e.product})},h=p=>{e.eventEmitter.emit("product:context-select",{product:e.product,key:p})};return(p,m)=>{var w;const g=Ql,b=Zl,y=F.NButton,_=F.NTooltip,k=Gl,x=ec,v=$s,B=F.NDropdown;return t.openBlock(),t.createElementBlock("div",$p,[a.value?(t.openBlock(),t.createBlock(_,{key:0,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createElementVNode("span",Ep,[t.createVNode(y,{ghost:!0,size:t.unref(i),disabled:a.value==="disabled",type:n.product.isRequired?"primary":"default",onClick:f},{default:t.withCtx(()=>[n.product.isRequired?(t.openBlock(),t.createBlock(b,{key:1})):(t.openBlock(),t.createBlock(g,{key:0}))]),_:1},8,["size","disabled","type"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(l.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),s.value?(t.openBlock(),t.createBlock(_,{key:1,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),type:"primary",disabled:s.value==="disabled",onClick:u},{default:t.withCtx(()=>[t.createVNode(k)]),_:1},8,["size","disabled"])]),default:t.withCtx(()=>[m[0]||(m[0]=t.createTextVNode(" Редактировать ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createBlock(_,{key:2,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),disabled:o.value==="disabled",type:"primary",onClick:d},{default:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["size","disabled"])]),default:t.withCtx(()=>[m[1]||(m[1]=t.createTextVNode(" Добавить в корзину ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),((w=c.value)==null?void 0:w.length)>0?(t.openBlock(),t.createBlock(B,{key:3,options:c.value,size:t.unref(i),trigger:"click",onSelect:h},{default:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(v)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])}}}),Pp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fp(n,e){return t.openBlock(),t.createElementBlock("svg",Pp,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M12 8v4l2 2"}),t.createElementVNode("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})],-1)])])}const Vp=t.markRaw({name:"tabler-history",render:Fp}),Mp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ip(n,e){return t.openBlock(),t.createElementBlock("svg",Mp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m18.5 3.5l2 2l-15 15l-2-2zM7 4c1.66 0 3 1.34 3 3s-1.34 3-3 3s-3-1.34-3-3s1.34-3 3-3m10 10c1.66 0 3 1.34 3 3s-1.34 3-3 3s-3-1.34-3-3s1.34-3 3-3M7 6c-.55 0-1 .45-1 1s.45 1 1 1s1-.45 1-1s-.45-1-1-1m10 10c-.55 0-1 .45-1 1s.45 1 1 1s1-.45 1-1s-.45-1-1-1"},null,-1)])])}const Ap=t.markRaw({name:"mdi-percent-outline",render:Ip}),Op={class:"flex flex-row gap-1"},zp={key:0,class:"flex gap-1"},Dp={key:0,class:"flex text-nowrap text-sm line-through"},Lp={key:1,class:"flex flex-row text-nowrap text-sm"},Hp={key:2,class:"flex flex-row gap-1 text-nowrap text-sm text-gray-600"},Wp={},ai=t.defineComponent({...Wp,__name:"product-cost",props:{product:{},additionalThroughFieldName:{},costFieldName:{},eventEmitter:{},allowPriceClick:{type:[Boolean,Function],default:!1},showTag:{type:Boolean,default:!1},showQuantityUnit:{type:Boolean,default:!1},showCurrency:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},showPriceHistory:{type:Boolean,default:!1},currencyRates:{default:void 0}},setup(n){var k;const e=n,i=t.computed(()=>"product"in e.product),r=t.computed(()=>"discount"in e.product&&e.product.discount?si.getFormatEntityName(e.product.discount):""),o=t.computed(()=>"product"in e.product?e.product.product:e.product),s=t.computed(()=>M.isNil(u.value)?"":e.showQuantityUnit?M.compact([o.value.currency.symbol,o.value.unit.name]).join("/"):e.showCurrency?o.value.currency.symbol:""),a=t.computed(()=>e.showQuantityUnit?M.compact(["₽",o.value.unit.name]).join("/"):e.showCurrency?"₽":""),l=t.computed(()=>M.find(o.value.priceCoefficients,["coefficient.slug",e.costFieldName])),c=t.computed(()=>{const x=M.find(o.value.priceCoefficients,["coefficient.slug","k0"]);return l.value||!x||M.isNil(u.value)||M.isNil(x.cost)?!1:u.value<x.cost}),d=((k=j.useBaseConfigStateStore().getConfig())==null?void 0:k.defaultCurrency)??"RUB",u=t.computed(()=>l.value?l.value.cost:M.get(e.product,e.costFieldName)),f=t.computed(()=>e.additionalThroughFieldName?M.get(e.product,e.additionalThroughFieldName):void 0),h=t.computed(()=>o.value.costDate?xe.format(o.value.costDate,j.useBaseConfigStateStore().config.dateFormats.uiDate):void 0),p=t.computed(()=>e.currencyRates||o.value.currency.signature===d?e.currencyRates:{[o.value.currency.signature]:o.value.costRub/o.value.cost}),m=t.computed(()=>(M.isFunction(e.allowPriceClick)?e.allowPriceClick(o.value):e.allowPriceClick)&&!M.isNil(u.value)),g=t.computed(()=>M.isNil(u.value)?"-":new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(Number.parseFloat(u.value))),b=t.computed(()=>{if(o.value.currency.signature===d||!p.value||!p.value[o.value.currency.signature])return null;const x=p.value[o.value.currency.signature];return new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(Number.parseFloat(u.value)*x)}),y=t.computed(()=>M.isNil(f.value)?null:new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(f.value)),_=t.computed(()=>{if(!f.value||!u.value||f.value===u.value||u.value===0)return null;const x=(u.value-f.value)/f.value*100;return new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}).format(x)});return(x,v)=>{var $;const B=F.NTag,w=F.NTooltip,T=Ap,C=Vp;return t.openBlock(),t.createElementBlock("div",Op,[n.showTag?(t.openBlock(),t.createBlock(w,{key:0},{trigger:t.withCtx(()=>[t.createVNode(B,{round:"",bordered:!1,size:"small",class:t.normalizeClass(["text-slate-600",{"font-bold":!l.value}])},{default:t.withCtx(()=>{var E;return[t.createTextVNode(t.toDisplayString(((E=l.value)==null?void 0:E.coefficient.slug)??"Ц"),1)]}),_:1},8,["class"])]),default:t.withCtx(()=>{var E;return[t.createTextVNode(" "+t.toDisplayString(((E=l.value)==null?void 0:E.coefficient.name)??"Розничная цена"),1)]}),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass({"!text-red-600":c.value})},[f.value&&f.value!==u.value||_.value?(t.openBlock(),t.createElementBlock("div",zp,[f.value&&f.value!==u.value?(t.openBlock(),t.createElementBlock("span",Dp,t.toDisplayString(y.value)+" "+t.toDisplayString(s.value),1)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock("span",{key:1,class:t.normalizeClass(["flex text-nowrap text-sm text-gray-600",{"!text-red-600":c.value}])}," ("+t.toDisplayString(_.value)+"%) ",3)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass(["whitespace-nowrap text-base flex items-center gap-1",{"text-gray-600":($=l.value)==null?void 0:$.readOnly,"font-bold":!l.value&&!i.value}])},[t.createElementVNode("span",{class:t.normalizeClass({"text-nowrap":!0,"cursor-pointer underline decoration-dashed":m.value&&n.eventEmitter}),onClick:v[0]||(v[0]=()=>{var E;m.value&&((E=n.eventEmitter)==null||E.emit("cost:click",{product:o.value,cost:u.value}))})},t.toDisplayString(g.value),3),t.createTextVNode(" "+t.toDisplayString(s.value)+" ",1),u.value&&!l.value&&"discount"in n.product&&n.product.discount?(t.openBlock(),t.createBlock(w,{key:0},{trigger:t.withCtx(()=>[t.createVNode(T,{class:"text-sm text-black bg-amber-400 rounded p-px"})]),default:t.withCtx(()=>[t.createElementVNode("span",null,' На продукт действует скидка "'+t.toDisplayString(r.value)+'"; ',1)]),_:1})):t.createCommentVNode("",!0)],2),b.value?(t.openBlock(),t.createElementBlock("span",Lp," ~ "+t.toDisplayString(b.value)+" "+t.toDisplayString(a.value),1)):t.createCommentVNode("",!0),n.showCostDate&&!t.unref(M.isNil)(h.value)?(t.openBlock(),t.createElementBlock("span",Hp,[t.createTextVNode(t.toDisplayString(h.value)+" ",1),n.showPriceHistory&&n.eventEmitter?(t.openBlock(),t.createBlock(w,{key:0,placement:"top-end"},{trigger:t.withCtx(()=>[t.createVNode(C,{class:"cursor-pointer",onClick:v[1]||(v[1]=E=>{var I;return(I=n.eventEmitter)==null?void 0:I.emit("cost:show-price-history",{product:o.value})})})]),default:t.withCtx(()=>[v[2]||(v[2]=t.createTextVNode(" История цен ",-1))]),_:1})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],2)])}}}),jp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function qp(n,e){return t.openBlock(),t.createElementBlock("svg",jp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M248 64C146.39 64 64 146.39 64 248s82.39 184 184 184s184-82.39 184-184S349.61 64 248 64Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M220 220h32v116"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32",d:"M208 340h88"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M248 130a26 26 0 1 0 26 26a26 26 0 0 0-26-26"},null,-1)])])}const lo=t.markRaw({name:"ion-information-circle-outline",render:qp}),Xp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Yp(n,e){return t.openBlock(),t.createElementBlock("svg",Xp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M450.29 112H142c-34 0-62 27.51-62 61.33v245.34c0 33.82 28 61.33 62 61.33h308c34 0 62-26.18 62-60V173.33c0-33.82-27.68-61.33-61.71-61.33m-77.15 61.34a46 46 0 1 1-46.28 46a46.19 46.19 0 0 1 46.28-46.01Zm-231.55 276c-17 0-29.86-13.75-29.86-30.66v-64.83l90.46-80.79a46.54 46.54 0 0 1 63.44 1.83L328.27 337l-113 112.33ZM480 418.67a30.67 30.67 0 0 1-30.71 30.66H259L376.08 333a46.24 46.24 0 0 1 59.44-.16L480 370.59Z"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M384 32H64A64 64 0 0 0 0 96v256a64.11 64.11 0 0 0 48 62V152a72 72 0 0 1 72-72h326a64.11 64.11 0 0 0-62-48"},null,-1)])])}const nc=t.markRaw({name:"ion-images",render:Yp}),Up={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Kp(n,e){return t.openBlock(),t.createElementBlock("svg",Up,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M256 56C145.72 56 56 145.72 56 256s89.72 200 200 200s200-89.72 200-200S366.28 56 256 56m0 82a26 26 0 1 1-26 26a26 26 0 0 1 26-26m48 226h-88a16 16 0 0 1 0-32h28v-88h-16a16 16 0 0 1 0-32h32a16 16 0 0 1 16 16v104h28a16 16 0 0 1 0 32"},null,-1)])])}const Gp=t.markRaw({name:"ion-information-circle",render:Kp}),Zp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Qp(n,e){return t.openBlock(),t.createElementBlock("svg",Zp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M400 480a16 16 0 0 1-10.63-4L256 357.41L122.63 476A16 16 0 0 1 96 464V96a64.07 64.07 0 0 1 64-64h192a64.07 64.07 0 0 1 64 64v368a16 16 0 0 1-16 16"},null,-1)])])}const Jp=t.markRaw({name:"ion-bookmark",render:Qp});/*!
|
|
2
2
|
* lightgallery | 2.9.0 | October 1st 2025
|
|
3
3
|
* http://www.lightgalleryjs.com/
|
|
4
4
|
* Copyright (c) 2020 Sachin Neravath;
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
38
38
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
39
39
|
PERFORMANCE OF THIS SOFTWARE.
|
|
40
|
-
***************************************************************************** */var uo=function(){return uo=Object.assign||function(e){for(var i,r=1,o=arguments.length;r<o;r++){i=arguments[r];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},uo.apply(this,arguments)},ng={scale:1,zoom:!0,infiniteZoom:!0,actualSize:!0,showZoomInOutIcons:!1,actualSizeIcons:{zoomIn:"lg-zoom-in",zoomOut:"lg-zoom-out"},enableZoomAfter:300,zoomPluginStrings:{zoomIn:"Zoom in",zoomOut:"Zoom out",viewActualSize:"View actual size"}},Ln={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Es=500,ig=(function(){function n(e,i){return this.core=e,this.$LG=i,this.settings=uo(uo({},ng),this.core.settings),this}return n.prototype.buildTemplates=function(){var e=this.settings.showZoomInOutIcons?'<button id="'+this.core.getIdName("lg-zoom-in")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomIn+'" class="lg-zoom-in lg-icon"></button><button id="'+this.core.getIdName("lg-zoom-out")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomOut+'" class="lg-zoom-out lg-icon"></button>':"";this.settings.actualSize&&(e+='<button id="'+this.core.getIdName("lg-actual-size")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.viewActualSize+'" class="'+this.settings.actualSizeIcons.zoomIn+' lg-icon"></button>'),this.core.outer.addClass("lg-use-transition-for-zoom"),this.core.$toolbar.first().append(e)},n.prototype.enableZoom=function(e){var i=this,r=this.settings.enableZoomAfter+e.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&e.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){i.isImageSlide(i.core.index)&&(i.core.getSlideItem(e.detail.index).addClass("lg-zoomable"),e.detail.index===i.core.index&&i.setZoomEssentials())},r+30)},n.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(Ln.slideItemLoad+".zoom",this.enableZoom.bind(this))},n.prototype.getDragCords=function(e){return{x:e.pageX,y:e.pageY}},n.prototype.getSwipeCords=function(e){var i=e.touches[0].pageX,r=e.touches[0].pageY;return{x:i,y:r}},n.prototype.getDragAllowedAxises=function(e,i){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),o=0,s=0,a=r.getBoundingClientRect();e?(o=r.offsetHeight*e,s=r.offsetWidth*e):i?(o=a.height+i*a.height,s=a.width+i*a.width):(o=a.height,s=a.width);var l=o>this.containerRect.height,c=s>this.containerRect.width;return{allowX:c,allowY:l}},n.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},n.prototype.zoomImage=function(e,i,r,o){if(!(!this.containerRect||Math.abs(i)<=0)){var s=this.containerRect.width/2+this.containerRect.left,a=this.containerRect.height/2+this.containerRect.top+this.scrollTop,l,c;e===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,i),u=d.allowY,f=d.allowX;this.positionChanged&&(l=this.left/(this.scale-i),c=this.top/(this.scale-i),this.pageX=s-l,this.pageY=a-c,this.positionChanged=!1);var h=this.getPossibleSwipeDragCords(i),p,m,g=s-this.pageX,b=a-this.pageY;if(e-i>1){var y=(e-i)/Math.abs(i);g=(i<0?-g:g)+this.left*(y+(i<0?-1:1)),b=(i<0?-b:b)+this.top*(y+(i<0?-1:1)),p=g/y,m=b/y}else{var y=(e-i)*i;p=g*y,m=b*y}r&&(f?this.isBeyondPossibleLeft(p,h.minX)?p=h.minX:this.isBeyondPossibleRight(p,h.maxX)&&(p=h.maxX):e>1&&(p<h.minX?p=h.minX:p>h.maxX&&(p=h.maxX)),u?this.isBeyondPossibleTop(m,h.minY)?m=h.minY:this.isBeyondPossibleBottom(m,h.maxY)&&(m=h.maxY):e>1&&(m<h.minY?m=h.minY:m>h.maxY&&(m=h.maxY))),this.setZoomStyles({x:p,y:m,scale:e}),this.left=p,this.top=m,o&&this.setZoomImageSize()}},n.prototype.resetImageTranslate=function(e){if(this.isImageSlide(e)){var i=this.core.getSlideItem(e).find(".lg-image").first();this.imageReset=!1,i.removeClass("reset-transition reset-transition-y reset-transition-x"),this.core.outer.removeClass("lg-actual-size"),i.css("width","auto").css("height","auto"),setTimeout(function(){i.removeClass("no-transition")},10)}},n.prototype.setZoomImageSize=function(){var e=this,i=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=e.getCurrentImageActualSizeScale();e.scale>=r&&(i.addClass("no-transition"),e.imageReset=!0)},Es),setTimeout(function(){var r=e.getCurrentImageActualSizeScale();if(e.scale>=r){var o=e.getDragAllowedAxises(e.scale);i.css("width",i.get().naturalWidth+"px").css("height",i.get().naturalHeight+"px"),e.core.outer.addClass("lg-actual-size"),o.allowX&&o.allowY?i.addClass("reset-transition"):o.allowX&&!o.allowY?i.addClass("reset-transition-x"):!o.allowX&&o.allowY&&i.addClass("reset-transition-y")}},Es+50)},n.prototype.setZoomStyles=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),o=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=e.scale,r.css("transform","scale3d("+e.scale+", "+e.scale+", 1)"),o.css("transform","scale3d("+e.scale+", "+e.scale+", 1)");var s="translate3d("+e.x+"px, "+e.y+"px, 0)";i.css("transform",s)},n.prototype.setActualSize=function(e,i){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var o=this.core.galleryItems[this.core.index];this.resetImageTranslate(e),setTimeout(function(){if(!(!o.src||r.core.outer.hasClass("lg-first-slide-loading"))){var s=r.getCurrentImageActualSizeScale(),a=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(s),r.setPageCords(i),r.beginZoom(r.scale),r.zoomImage(r.scale,r.scale-a,!0,!0)}},50),setTimeout(function(){r.core.outer.removeClass("lg-grabbing").addClass("lg-grab")},60),setTimeout(function(){r.zoomInProgress=!1},Es+110)}},n.prototype.getNaturalWidth=function(e){var i=this.core.getSlideItem(e).find(".lg-image").first(),r=this.core.galleryItems[e].width;return r?parseFloat(r):i.get().naturalWidth},n.prototype.getActualSizeScale=function(e,i){var r,o;return e>=i?(r=e/i,o=r||2):o=1,o},n.prototype.getCurrentImageActualSizeScale=function(){var e=this.core.getSlideItem(this.core.index).find(".lg-image").first(),i=e.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||i;return this.getActualSizeScale(r,i)},n.prototype.getPageCords=function(e){var i={};if(e)i.x=e.pageX||e.touches[0].pageX,i.y=e.pageY||e.touches[0].pageY;else{var r=this.core.$content.get().getBoundingClientRect();i.x=r.width/2+r.left,i.y=r.height/2+this.scrollTop+r.top}return i},n.prototype.setPageCords=function(e){var i=this.getPageCords(e);this.pageX=i.x,this.pageY=i.y},n.prototype.manageActualPixelClassNames=function(){var e=this.core.getElementById("lg-actual-size");e.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},n.prototype.beginZoom=function(e){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),e>1},n.prototype.getScale=function(e){var i=this.getCurrentImageActualSizeScale();return e<1?e=1:e>i&&(e=i),e},n.prototype.init=function(){var e=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var i=null;this.core.outer.on("dblclick.lg",function(r){e.$LG(r.target).hasClass("lg-image")&&e.setActualSize(e.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var o=e.$LG(r.target);r.touches.length===1&&o.hasClass("lg-image")&&(i?(clearTimeout(i),i=null,r.preventDefault(),e.setActualSize(e.core.index,r)):i=setTimeout(function(){i=null},300))}),this.core.LGel.on(Ln.containerResize+".zoom "+Ln.rotateRight+".zoom "+Ln.rotateLeft+".zoom "+Ln.flipHorizontal+".zoom "+Ln.flipVertical+".zoom",function(){if(!(!e.core.lgOpened||!e.isImageSlide(e.core.index)||e.core.touchAction)){var r=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();e.top=0,e.left=0,e.setZoomEssentials(),e.setZoomSwipeStyles(r,{x:0,y:0}),e.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){e.core.lgOpened&&(e.scrollTop=e.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(e.isImageSlide(e.core.index)){var r=0;e.imageReset&&(e.resetImageTranslate(e.core.index),r=50),setTimeout(function(){var o=e.scale-e.settings.scale;o<1&&(o=1),e.beginZoom(o),e.zoomImage(o,-e.settings.scale,!0,!e.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){e.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){e.setActualSize(e.core.index)}),this.core.LGel.on(Ln.beforeOpen+".zoom",function(){e.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(Ln.afterOpen+".zoom",function(){e.scrollTop=e.$LG(window).scrollTop(),e.pageX=e.core.outer.width()/2,e.pageY=e.core.outer.height()/2+e.scrollTop,e.scale=1}),this.core.LGel.on(Ln.afterSlide+".zoom",function(r){var o=r.detail.prevIndex;e.scale=1,e.positionChanged=!1,e.zoomInProgress=!1,e.resetZoom(o),e.resetImageTranslate(o),e.isImageSlide(e.core.index)&&e.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},n.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var e=this.scale+this.settings.scale;this.settings.infiniteZoom||(e=this.getScale(e)),this.beginZoom(e),this.zoomImage(e,Math.min(this.settings.scale,e-this.scale),!0,!this.settings.infiniteZoom)}},n.prototype.resetZoom=function(e){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var i=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(e!==void 0?e:this.core.index);i.removeClass(this.settings.actualSizeIcons.zoomOut).addClass(this.settings.actualSizeIcons.zoomIn),r.find(".lg-img-wrap").first().removeAttr("style"),r.find(".lg-image").first().removeAttr("style"),this.scale=1,this.left=0,this.top=0,this.setPageCords()},n.prototype.getTouchDistance=function(e){return Math.sqrt((e.touches[0].pageX-e.touches[1].pageX)*(e.touches[0].pageX-e.touches[1].pageX)+(e.touches[0].pageY-e.touches[1].pageY)*(e.touches[0].pageY-e.touches[1].pageY))},n.prototype.pinchZoom=function(){var e=this,i=0,r=!1,o=1,s=0,a=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(l){if(a=e.core.getSlideItem(e.core.index),!!e.isImageSlide(e.core.index)&&l.touches.length===2){if(l.preventDefault(),e.core.outer.hasClass("lg-first-slide-loading"))return;o=e.scale||1,e.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e.setPageCords(l),e.resetImageTranslate(e.core.index),e.core.touchAction="pinch",i=e.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=e.getTouchDistance(l),d=i-c;if(!r&&Math.abs(d)>5&&(r=!0),r){s=e.scale;var u=Math.max(1,o+-d*.02);e.scale=Math.round((u+Number.EPSILON)*100)/100;var f=e.scale-s;e.zoomImage(e.scale,Math.round((f+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,i=0,e.scale<=1)e.resetZoom();else{var c=e.getCurrentImageActualSizeScale();if(e.scale>=c){var d=c-e.scale;d===0&&(d=.01),e.zoomImage(c,d,!1,!0)}e.manageActualPixelClassNames(),e.core.outer.addClass("lg-zoomed")}e.core.touchAction=void 0}})},n.prototype.touchendZoom=function(e,i,r,o,s){var a=i.x-e.x,l=i.y-e.y,c=Math.abs(a)/s+1,d=Math.abs(l)/s+1;c>2&&(c+=1),d>2&&(d+=1),a=a*c,l=l*d;var u=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),f={};f.x=this.left+a,f.y=this.top+l;var h=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(o&&(this.isBeyondPossibleTop(f.y,h.minY)?f.y=h.minY:this.isBeyondPossibleBottom(f.y,h.maxY)&&(f.y=h.maxY)),r&&(this.isBeyondPossibleLeft(f.x,h.minX)?f.x=h.minX:this.isBeyondPossibleRight(f.x,h.maxX)&&(f.x=h.maxX)),o?this.top=f.y:f.y=this.top,r?this.left=f.x:f.x=this.left,this.setZoomSwipeStyles(u,f),this.positionChanged=!0)},n.prototype.getZoomSwipeCords=function(e,i,r,o,s){var a={};if(o){if(a.y=this.top+(i.y-e.y),this.isBeyondPossibleTop(a.y,s.minY)){var l=s.minY-a.y;a.y=s.minY-l/6}else if(this.isBeyondPossibleBottom(a.y,s.maxY)){var c=a.y-s.maxY;a.y=s.maxY+c/6}}else a.y=this.top;if(r){if(a.x=this.left+(i.x-e.x),this.isBeyondPossibleLeft(a.x,s.minX)){var d=s.minX-a.x;a.x=s.minX-d/6}else if(this.isBeyondPossibleRight(a.x,s.maxX)){var u=a.x-s.maxX;a.x=s.maxX+u/6}}else a.x=this.left;return a},n.prototype.isBeyondPossibleLeft=function(e,i){return e>=i},n.prototype.isBeyondPossibleRight=function(e,i){return e<=i},n.prototype.isBeyondPossibleTop=function(e,i){return e>=i},n.prototype.isBeyondPossibleBottom=function(e,i){return e<=i},n.prototype.isImageSlide=function(e){var i=this.core.galleryItems[e];return this.core.getSlideType(i)==="image"},n.prototype.getPossibleSwipeDragCords=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,o=i.get().getBoundingClientRect(),s=o.height,a=o.width;e&&(s=s+e*s,a=a+e*a);var l=(s-this.containerRect.height)/2,c=(this.containerRect.height-s)/2+r,d=(a-this.containerRect.width)/2,u=(this.containerRect.width-a)/2,f={minY:l,maxY:c,minX:d,maxX:u};return f},n.prototype.setZoomSwipeStyles=function(e,i){e.css("transform","translate3d("+i.x+"px, "+i.y+"px, 0)")},n.prototype.zoomSwipe=function(){var e=this,i={},r={},o=!1,s=!1,a=!1,l=new Date,c=new Date,d,u,f=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(h){if(e.isImageSlide(e.core.index)&&(f=e.core.getSlideItem(e.core.index),(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))&&h.touches.length===1&&e.core.outer.hasClass("lg-zoomed"))){h.preventDefault(),l=new Date,e.core.touchAction="zoomSwipe",u=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var p=e.getDragAllowedAxises(0);a=p.allowY,s=p.allowX,(s||a)&&(i=e.getSwipeCords(h)),d=e.getPossibleSwipeDragCords(),e.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(h){if(h.touches.length===1&&e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){h.preventDefault(),e.core.touchAction="zoomSwipe",r=e.getSwipeCords(h);var p=e.getZoomSwipeCords(i,r,s,a,d);(Math.abs(r.x-i.x)>15||Math.abs(r.y-i.y)>15)&&(o=!0,e.setZoomSwipeStyles(u,p))}}),this.core.$inner.on("touchend.lg",function(h){if(e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){if(h.preventDefault(),e.core.touchAction=void 0,e.core.outer.removeClass("lg-zoom-dragging"),!o)return;o=!1,c=new Date;var p=c.valueOf()-l.valueOf();e.touchendZoom(i,r,s,a,p)}})},n.prototype.zoomDrag=function(){var e=this,i={},r={},o=!1,s=!1,a=!1,l=!1,c,d,u,f;this.core.outer.on("mousedown.lg.zoom",function(h){if(e.isImageSlide(e.core.index)){var p=e.core.getSlideItem(e.core.index);if(e.$LG(h.target).hasClass("lg-item")||p.get().contains(h.target)){c=new Date,f=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var m=e.getDragAllowedAxises(0);l=m.allowY,a=m.allowX,e.core.outer.hasClass("lg-zoomed")&&e.$LG(h.target).hasClass("lg-object")&&(a||l)&&(h.preventDefault(),i=e.getDragCords(h),u=e.getPossibleSwipeDragCords(),o=!0,e.core.outer.removeClass("lg-grab").addClass("lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"))}}}),this.$LG(window).on("mousemove.lg.zoom.global"+this.core.lgId,function(h){if(o){s=!0,r=e.getDragCords(h);var p=e.getZoomSwipeCords(i,r,a,l,u);e.setZoomSwipeStyles(f,p)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(h){if(o){if(d=new Date,o=!1,e.core.outer.removeClass("lg-zoom-dragging"),s&&(i.x!==r.x||i.y!==r.y)){r=e.getDragCords(h);var p=d.valueOf()-c.valueOf();e.touchendZoom(i,r,a,l,p)}s=!1}e.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},n.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},n.prototype.destroy=function(){this.$LG(window).off(".lg.zoom.global"+this.core.lgId),this.core.LGel.off(".lg.zoom"),this.core.LGel.off(".zoom"),clearTimeout(this.zoomableTimeout),this.zoomableTimeout=!1},n})();const rg={ref:"gallery-container",class:"lightgallery-wrapper"},og={},ic=t.defineComponent({...og,__name:"lightgallery",props:{settings:{},onAfterAppendSlide:{type:Function},onInit:{type:Function},onHasVideo:{type:Function},onContainerResize:{type:Function},onAfterAppendSubHtml:{type:Function},onBeforeOpen:{type:Function},onAfterOpen:{type:Function},onSlideItemLoad:{type:Function},onBeforeSlide:{type:Function},onAfterSlide:{type:Function},onPosterClick:{type:Function},onDragStart:{type:Function},onDragMove:{type:Function},onDragEnd:{type:Function},onBeforeNextSlide:{type:Function},onBeforePrevSlide:{type:Function},onBeforeClose:{type:Function},onAfterClose:{type:Function},onRotateLeft:{type:Function},onRotateRight:{type:Function},onFlipHorizontal:{type:Function},onFlipVertical:{type:Function}},setup(n){const e=n,i={lgAfterAppendSlide:e.onAfterAppendSlide,lgInit:e.onInit,lgHasVideo:e.onHasVideo,lgContainerResize:e.onContainerResize,lgAfterAppendSubHtml:e.onAfterAppendSubHtml,lgBeforeOpen:e.onBeforeOpen,lgAfterOpen:e.onAfterOpen,lgSlideItemLoad:e.onSlideItemLoad,lgBeforeSlide:e.onBeforeSlide,lgAfterSlide:e.onAfterSlide,lgPosterClick:e.onPosterClick,lgDragStart:e.onDragStart,lgDragMove:e.onDragMove,lgDragEnd:e.onDragEnd,lgBeforeNextSlide:e.onBeforeNextSlide,lgBeforePrevSlide:e.onBeforePrevSlide,lgBeforeClose:e.onBeforeClose,lgAfterClose:e.onAfterClose,lgRotateLeft:e.onRotateLeft,lgRotateRight:e.onRotateRight,lgFlipHorizontal:e.onFlipHorizontal,lgFlipVertical:e.onFlipVertical},r=t.useTemplateRef("gallery-container"),o=t.ref(null);return t.onMounted(async()=>{if(!r.value)return;const s=await import("lightgallery");o.value=s.default(r.value,{...e.settings}),M.forOwn(i,(a,l)=>{var c;a&&((c=r.value)==null||c.addEventListener(l,a))})}),t.onBeforeUnmount(()=>{var s;o.value&&((s=o.value)==null||s.destroy(),o.value=null)}),(s,a)=>(t.openBlock(),t.createElementBlock("div",rg,[t.renderSlot(s.$slots,"default")],512))}}),sg=["href"],ag=["src","alt"],lg={},rc=t.defineComponent({...lg,__name:"image-gallery",props:{images:{}},setup(n,{expose:e}){const i=t.ref(!1),r=t.ref(!1),o=t.ref({plugins:[tg,ig],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),s=()=>window.innerWidth*(Xe.getDeviceTypeByResolution()===je.phone?.7:.8),a=t.ref(s()),l=()=>{a.value=s()},c=()=>{i.value=!0};return t.onUnmounted(()=>{window.removeEventListener("resize",l)}),e({show:c}),window.addEventListener("resize",l),(d,u)=>{const f=nc,h=F.NPopover;return t.openBlock(),t.createBlock(h,{trigger:"manual",show:i.value,class:"sc-image",placement:"top-start",onClickoutside:u[3]||(u[3]=()=>{r.value||(i.value=!1)})},{trigger:t.withCtx(()=>[t.createElementVNode("div",{class:"inline-flex",onClick:u[0]||(u[0]=p=>i.value=!i.value)},[t.renderSlot(d.$slots,"default",{},()=>[t.createVNode(f)])])]),default:t.withCtx(()=>[t.createVNode(ic,{settings:o.value,style:t.normalizeStyle(`max-width: ${a.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:u[1]||(u[1]=()=>{r.value=!0}),onAfterClose:u[2]||(u[2]=()=>{r.value=!1,i.value=!1})},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.images,(p,m)=>(t.openBlock(),t.createElementBlock("a",{key:m,href:p.image},[t.createElementVNode("img",{src:p.preview,alt:`Изображение #${m+1}`},null,8,ag)],8,sg))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),cg={class:"text-sm grid grid-cols-[auto_auto] gap-x-3 gap-y-1 items-baseline"},dg={class:"pr-3"},ug={class:"text-right"},fg={},hg=t.defineComponent({...fg,__name:"product-stock-count",props:{product:{}},setup(n){return(e,i)=>{const r=lo,o=F.NPopover;return t.openBlock(),t.createBlock(o,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(r)])]),default:t.withCtx(()=>[t.createElementVNode("div",cg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.product.stockCount,(s,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:a},[t.createElementVNode("span",dg,t.toDisplayString(s.warehouse.name),1),t.createElementVNode("span",ug,[t.createTextVNode(t.toDisplayString(s.count??"В наличии")+" ",1),s.count?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(n.product.unit.name),1)],64)):t.createCommentVNode("",!0)])],64))),128))])]),_:3})}}}),mg=["innerHTML"],pg=["innerHTML"],gg={class:"m-0 flex list-none flex-col gap-1 p-0 text-sm"},yg=["href"],bg={key:1,class:"text-sm text-gray-500"},_g={},Rs=t.defineComponent({..._g,__name:"product-info-content",props:{product:{},size:{default:"medium"},maxHeight:{default:void 0},activeTab:{default:void 0}},setup(n){const e=n,i=t.computed(()=>e.maxHeight?{maxHeight:e.maxHeight}:void 0),r=t.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.description)??""}),o=t.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.specification)??""}),s=t.computed(()=>Ts(e.product)),a=t.computed(()=>[r.value?"description":null,o.value?"specification":null,s.value.length>0?"files":null].filter(c=>c!==null)),l=t.ref(e.activeTab&&a.value.includes(e.activeTab)?e.activeTab:a.value[0]);return(c,d)=>{const u=F.NScrollbar,f=F.NTabPane,h=F.NTabs;return a.value.length>0?(t.openBlock(),t.createBlock(h,{key:0,value:l.value,"onUpdate:value":d[0]||(d[0]=p=>l.value=p),size:n.size,type:"line",class:"sc-product-info-content"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createBlock(f,{key:0,name:"description",tab:"Описание"},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("div",{class:"sc-product-info-html",innerHTML:r.value},null,8,mg)]),_:1},8,["style"])]),_:1})):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createBlock(f,{key:1,name:"specification",tab:"Характеристики"},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("div",{class:"sc-product-info-html",innerHTML:o.value},null,8,pg)]),_:1},8,["style"])]),_:1})):t.createCommentVNode("",!0),s.value.length>0?(t.openBlock(),t.createBlock(f,{key:2,name:"files",tab:`Файлы (${s.value.length})`},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("ul",gg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,p=>(t.openBlock(),t.createElementBlock("li",{key:p.id},[t.createElementVNode("a",{href:p.url,target:"_blank",rel:"noopener"},t.toDisplayString(p.typeName),9,yg)]))),128))])]),_:1},8,["style"])]),_:1},8,["tab"])):t.createCommentVNode("",!0)]),_:1},8,["value","size"])):(t.openBlock(),t.createElementBlock("span",bg," Описание, характеристики и файлы не заданы. "))}}}),wg={key:0,class:"flex flex-row gap-2.5"},xg={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},kg={},Ps=t.defineComponent({...kg,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},modalWidth:{default:void 0},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})},trapFocus:{type:Boolean,default:!0}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.show),a=t.ref(r.processing),l=Xe.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=Xe.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=t.computed(()=>r.modalWidth??window.innerWidth*c.value),u=()=>{o("opening"),s.value=!0,o("update:show",s.value)},f=(p="other",m=!1)=>{if(a.value&&!m){o("processing:cancel",_=>{a.value=_});return}let g=!1;o("closing",p,()=>{g=!0}),g||(s.value=!1,o("update:show",s.value))},h=()=>{o("accept",m=>{a.value=m})};return t.watch(()=>r.show,p=>{p?u():f("other",!0)}),t.watch(()=>r.processing,p=>{a.value=p}),e({open:u,close:f,acceptHandler:h}),(p,m)=>{const g=F.NButton,b=F.NModal;return t.openBlock(),t.createBlock(b,{loading:a.value,show:s.value,"show-icon":!1,size:t.unref(l),style:t.normalizeStyle(`width: ${d.value}px`),title:n.title,"trap-focus":n.trapFocus??!0,"action-class":p.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:m[1]||(m[1]=y=>f("header")),onEsc:m[2]||(m[2]=y=>f("esc")),onMaskClick:m[3]||(m[3]=y=>f("mask"))},t.createSlots({default:t.withCtx(()=>[t.renderSlot(p.$slots,"default")]),_:2},[p.$slots.header?{name:"header",fn:t.withCtx(()=>[t.renderSlot(p.$slots,"header")]),key:"0"}:void 0,p.$slots.action||p.$slots["extra-action"]||n.acceptButton.show||n.cancelButton.show?{name:"action",fn:t.withCtx(()=>[p.$slots["extra-action"]?(t.openBlock(),t.createElementBlock("div",wg,[t.renderSlot(p.$slots,"extra-action")])):t.createCommentVNode("",!0),p.$slots.action||n.acceptButton.show||n.cancelButton.show?(t.openBlock(),t.createElementBlock("div",xg,[t.renderSlot(p.$slots,"action",{disabled:a.value}),n.acceptButton.show??!0?(t.openBlock(),t.createBlock(g,{key:0,disabled:a.value||!n.valid,loading:a.value,size:t.unref(l),type:"primary",onClick:h},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","loading","size"])):t.createCommentVNode("",!0),n.cancelButton.show??!0?(t.openBlock(),t.createBlock(g,{key:1,disabled:a.value,size:t.unref(l),type:"default",onClick:m[0]||(m[0]=y=>f("footer"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.cancelButton.text??"Отмена"),1)]),_:1},8,["disabled","size"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","trap-focus","action-class"])}}}),Cg={class:"flex flex-col gap-3"},vg={class:"text-xs text-gray-500"},Sg={},oc=t.defineComponent({...Sg,__name:"product-info-dialog",props:{product:{},show:{type:Boolean,default:!1},activeTab:{default:void 0}},emits:["update:show"],setup(n,{emit:e}){const i=e,r=()=>{i("update:show",!1)};return(o,s)=>(t.openBlock(),t.createBlock(Ps,{show:n.show,title:n.product.name,"accept-button":{show:!1},"cancel-button":{show:!0,text:"Закрыть"},"trap-focus":!1,onClosing:r},{default:t.withCtx(()=>[t.createElementVNode("div",Cg,[t.createElementVNode("span",vg,"Артикул: "+t.toDisplayString(n.product.code),1),t.createVNode(Rs,{product:n.product,"active-tab":n.activeTab,"max-height":"60vh"},null,8,["product","active-tab"])])]),_:1},8,["show","title"]))}}),Bg={class:"flex flex-col gap-2"},Ng={class:"flex justify-end border-0 border-t border-solid border-gray-200 pt-2"},Tg={},sc=t.defineComponent({...Tg,__name:"product-info-popover",props:{product:{}},setup(n){const e=t.ref(!1),i=t.ref(!1),r=t.ref(!1),o=()=>{e.value=!1,i.value=!0,r.value=!0};return(s,a)=>{const l=lo,c=F.NButton,d=F.NPopover;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(d,{show:e.value,"onUpdate:show":a[0]||(a[0]=u=>e.value=u),width:560,style:{maxWidth:"calc(100vw - 2rem)"},trigger:"click",placement:"bottom-start",class:"sc-product-info-popover"},{trigger:t.withCtx(()=>[t.renderSlot(s.$slots,"default",{},()=>[t.createVNode(l,{title:"Описание и характеристики",class:"cursor-pointer"})])]),default:t.withCtx(()=>[t.createElementVNode("div",Bg,[t.createVNode(Rs,{product:n.product,size:"small","max-height":"16rem"},null,8,["product"]),t.createElementVNode("div",Ng,[t.createVNode(c,{text:"",type:"info",size:"small",onClick:o},{default:t.withCtx(()=>[...a[2]||(a[2]=[t.createTextVNode(" Открыть полностью ",-1)])]),_:1})])])]),_:3},8,["show"]),i.value?(t.openBlock(),t.createBlock(oc,{key:0,show:r.value,"onUpdate:show":a[1]||(a[1]=u=>r.value=u),product:n.product},null,8,["show","product"])):t.createCommentVNode("",!0)],64)}}}),$g={class:"flex flex-row justify-between"},Eg={key:0,class:"inline-flex flex-row gap-0.5 mr-2 align-sub"},Rg={key:1},Pg={class:"ml-2 align-sub"},Fg={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},Vg={key:2,class:"ml-2 align-sub"},Mg={class:"@container"},Ig={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},Ag={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},Og={class:"text-sc-dark-grey"},zg={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},Dg={class:"text-gray-600"},Lg={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},Hg={key:3,class:"underline decoration-dashed"},Wg={key:4,class:"sc-product-pack whitespace-nowrap"},jg={class:"text-gray-600"},qg={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},Xg={class:"text-gray-600"},Yg={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},Ug={key:0},Kg={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Gg={},Tr=t.defineComponent({...Gg,__name:"product-name",props:{product:{},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showCode:{type:Boolean,default:!0},showProductCosts:{type:[Boolean,Function],default:!1},showPlanningDates:{type:Boolean,default:!0},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showAdditionalSaleIcon:{type:Boolean,default:!1},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(n,{expose:e}){const i=n,r=t.computed(()=>M.isFunction(i.showProductCosts)?i.showProductCosts(i.product):i.showProductCosts),o=t.computed(()=>M.sortBy(i.product.priceCoefficients,["coefficient.slug"])),s=t.computed(()=>{var h,p;return(p=(h=i.product)==null?void 0:h.properties)==null?void 0:p.planingIncomingDate}),a=t.useTemplateRef("image-gallery"),l=()=>{var h;(h=a.value)==null||h.show()},c=t.computed(()=>M.isFunction(i.allowNameClick)?i.allowNameClick(i.product):i.allowNameClick),d=t.computed(()=>(M.isFunction(i.showProductInfoButton)?i.showProductInfoButton(i.product):i.showProductInfoButton)&&Kl(i.product)),u=t.computed(()=>{var h;return i.showProductAddToCartButton||i.showProductEditButton||i.showProductRequiredButton||(((h=i.productContextButtonsConfig)==null?void 0:h.length)??0)>0}),f=()=>{var h;c.value&&((h=i.eventEmitter)==null||h.emit("product:name-click",{product:i.product,exposedMethods:{showProductImagesPreview:l}}))};return e({showProductImagesPreview:l}),(h,p)=>{var w,T,C,$;const m=Jp,g=F.NTooltip,b=ec,y=Gp,_=nc,k=F.NText,x=tc,v=lo,B=F.NScrollbar;return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",$g,[t.createVNode(k,{type:"info",class:"sc-product-name text-balance text-base font-medium text-black"},{default:t.withCtx(()=>{var E,I,R,O;return[(E=n.product)!=null&&E.isFavorite||(I=n.product)!=null&&I.isPreviouslyOrdered||n.showAdditionalSaleIcon?(t.openBlock(),t.createElementBlock("div",Eg,[((R=n.product)==null?void 0:R.isFavorite)??!1?(t.openBlock(),t.createBlock(g,{key:0,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(m,{class:"!text-yellow-300"})]),default:t.withCtx(()=>[p[0]||(p[0]=t.createTextVNode(" Избранный товар ",-1))]),_:1})):t.createCommentVNode("",!0),((O=n.product)==null?void 0:O.isPreviouslyOrdered)??!1?(t.openBlock(),t.createBlock(g,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(b,{class:"!text-green-700"})]),default:t.withCtx(()=>[p[1]||(p[1]=t.createTextVNode(" Ранее заказанный товар ",-1))]),_:1})):t.createCommentVNode("",!0),n.showAdditionalSaleIcon?(t.openBlock(),t.createBlock(g,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(y,{class:"!text-green-500"})]),default:t.withCtx(()=>[p[2]||(p[2]=t.createTextVNode(" Дополнительная продажа ",-1))]),_:1})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass({"cursor-pointer":c.value&&n.eventEmitter,"text-gray-400 line-through":n.product.isHidden}),onClick:f},t.toDisplayString(n.product.name),3),n.product.onOrder?(t.openBlock(),t.createElementBlock("span",Rg," [Под заказ] ")):t.createCommentVNode("",!0),t.createElementVNode("span",Pg,[n.product.images&&n.product.images.length>0?(t.openBlock(),t.createBlock(rc,{key:0,ref:"image-gallery",images:n.product.images},{default:t.withCtx(()=>[t.createElementVNode("div",Fg,[t.createVNode(_)])]),_:1},8,["images"])):t.createCommentVNode("",!0)]),d.value?(t.openBlock(),t.createElementBlock("span",Vg,[t.createVNode(sc,{product:n.product},null,8,["product"])])):t.createCommentVNode("",!0)]}),_:1}),u.value?(t.openBlock(),t.createBlock(x,{key:0,product:n.product,"event-emitter":n.eventEmitter,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-edit-button":n.showProductEditButton,"show-product-required-button":n.showProductRequiredButton,"product-context-buttons-config":n.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",Mg,[t.createElementVNode("div",Ig,[n.product.supplierSku?(t.openBlock(),t.createElementBlock("div",Ag,[p[3]||(p[3]=t.createTextVNode(" Артикул производителя/поставщика: ",-1)),t.createElementVNode("span",Og,t.toDisplayString(n.product.supplierSku),1)])):t.createCommentVNode("",!0),n.showCode?(t.openBlock(),t.createElementBlock("span",zg,[p[4]||(p[4]=t.createTextVNode(" Артикул: ",-1)),t.createElementVNode("span",Dg,t.toDisplayString(n.product.code),1)])):t.createCommentVNode("",!0),n.product.stockCount&&n.product.stockCount.length>0?(t.openBlock(),t.createBlock(hg,{key:2,product:n.product},{default:t.withCtx(()=>[t.createElementVNode("span",Lg,[p[5]||(p[5]=t.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),t.createVNode(v,{class:"mt-0.5"})])]),_:1},8,["product"])):(t.openBlock(),t.createElementBlock("span",Hg," Нет в наличии ")),n.product.pack??((T=(w=n.product)==null?void 0:w.properties)==null?void 0:T.pack)?(t.openBlock(),t.createElementBlock("span",Wg,[p[6]||(p[6]=t.createTextVNode(" Норма упаковки: ",-1)),t.createElementVNode("span",jg,t.toDisplayString(n.product.pack??(($=(C=n.product)==null?void 0:C.properties)==null?void 0:$.pack)),1)])):t.createCommentVNode("",!0),n.showPlanningDates&&s.value?(t.openBlock(),t.createElementBlock("span",qg,[p[7]||(p[7]=t.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),t.createElementVNode("span",Xg,t.toDisplayString(s.value),1)])):t.createCommentVNode("",!0)])]),t.createVNode(B,{"x-scrollable":""},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",Yg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,E=>(t.openBlock(),t.createBlock(ai,{key:E.coefficient.slug,product:n.product,"cost-field-name":E.coefficient.slug??"","event-emitter":n.eventEmitter,"allow-price-click":n.allowPriceClick,"show-tag":!0,"show-price-history":n.showPriceHistory,"currency-rates":n.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),t.createVNode(ai,{product:n.product,"event-emitter":n.eventEmitter,"allow-price-click":n.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":n.showCostDate,"show-price-history":n.showPriceHistory,"currency-rates":n.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):t.createCommentVNode("",!0)]),_:1}),n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",Ug,[t.createElementVNode("ul",Kg,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.product.id,slug:n.product.slug},(E,I)=>(t.openBlock(),t.createElementBlock("li",{key:I}," ("+t.toDisplayString(I)+"): "+t.toDisplayString(E),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.product.properties,(E,I)=>(t.openBlock(),t.createElementBlock("li",{key:I}," ("+t.toDisplayString(I)+"): "+t.toDisplayString(E),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)])}}}),Zg=(n,e,i)=>({key:n,title:e,className:"align-top",resizable:!0,render:r=>t.h(ai,{product:r,costFieldName:n,eventEmitter:i.eventEmitter,allowPriceClick:i.allowPriceClick,currencyRates:i.currencyRates})}),Qg=(n,e)=>{if(n.length===0)return[];const i=[],r={};switch(M.isNil(e.isProductItemSelected)||i.push({key:"checkbox",title:"",className:"align-top",width:"32",render:o=>{var s,a;return t.h(F.NCheckbox,{checked:!!((s=e.isProductItemSelected)!=null&&s.call(e,o)),disabled:((a=e.isProductItemSelected)==null?void 0:a.call(e,o))==="disabled",onUpdateChecked:l=>{e.eventEmitter.emit("product:checked",{product:o,checked:l})}})}}),Xe.getDeviceTypeByResolution()){case je.phone:case je.tablet:i.push({key:"name",title:"Наименование",className:"align-top",render:o=>t.h(Tr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig})});break;default:i.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:o=>t.h(Tr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,currencyRates:e.currencyRates})}),e.showProductCosts&&(M.forEach(n,o=>{M.forEach(o.priceCoefficients,s=>{r[s.coefficient.slug??""]||(r[s.coefficient.slug??""]=s.coefficient)})}),M.forEach(M.sortBy(r,["slug"]),o=>{i.push(Zg(o.slug??"",o.name,e))}),i.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:o=>t.h(ai,{product:o,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:e.eventEmitter,allowPriceClick:e.allowPriceClick,showQuantityUnit:!0,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})})),(e.showProductEditButton||e.showProductRequiredButton||e.showProductAddToCartButton||!M.isNil(e.productContextButtonsConfig))&&i.push({key:"actions",title:"",className:"align-top",width:"50",render:o=>t.h(tc,{product:o,eventEmitter:e.eventEmitter,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,productContextButtonsConfig:e.productContextButtonsConfig})});break}return i},Jg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ey(n,e){return t.openBlock(),t.createElementBlock("svg",Jg,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",d:"M296 64h-80a7.91 7.91 0 0 0-8 8v24h96V72a7.91 7.91 0 0 0-8-8"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M432 96h-96V72a40 40 0 0 0-40-40h-80a40 40 0 0 0-40 40v24H80a16 16 0 0 0 0 32h17l19 304.92c1.42 26.85 22 47.08 48 47.08h184c26.13 0 46.3-19.78 48-47l19-305h17a16 16 0 0 0 0-32M192.57 416H192a16 16 0 0 1-16-15.43l-8-224a16 16 0 1 1 32-1.14l8 224A16 16 0 0 1 192.57 416M272 400a16 16 0 0 1-32 0V176a16 16 0 0 1 32 0Zm32-304h-96V72a7.91 7.91 0 0 1 8-8h80a7.91 7.91 0 0 1 8 8Zm32 304.57A16 16 0 0 1 320 416h-.58A16 16 0 0 1 304 399.43l8-224a16 16 0 1 1 32 1.14Z"},null,-1)])])}const fo=t.markRaw({name:"ion-trash",render:ey}),ty={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ny(n,e){return t.openBlock(),t.createElementBlock("svg",ty,[...e[0]||(e[0]=[t.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const ac=t.markRaw({name:"ion-plus",render:ny}),iy={key:0,class:"flex w-fit items-center gap-2"},ry={key:1,class:"flex flex-wrap gap-1"},oy={key:0},sy={key:2},ay={},$r=t.defineComponent({...ay,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0},validation:{default:void 0}},setup(n){const e=n,i=t.computed(()=>{var r,o;return(o=(r=e.product)==null?void 0:r.properties)==null?void 0:o.planingProductionDate});return(r,o)=>{const s=F.NSpin,a=F.NText;return n.isProductSearching?(t.openBlock(),t.createElementBlock("div",iy,[t.createVNode(s,{size:17,class:"w-fit"}),o[0]||(o[0]=t.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):n.product&&!n.product.isNewRec()?(t.openBlock(),t.createElementBlock("div",ry,[t.createElementVNode("div",null,t.toDisplayString(n.product.code)+" - "+t.toDisplayString(n.product.name)+" - "+t.toDisplayString(n.product.costRub.toLocaleString())+" ₽ / "+t.toDisplayString(n.product.unit.name),1),i.value?(t.openBlock(),t.createElementBlock("div",oy,"(Планируемая дата производства: "+t.toDisplayString(i.value)+")",1)):t.createCommentVNode("",!0)])):n.validation?(t.openBlock(),t.createElementBlock("div",sy,[t.createVNode(a,{type:n.validation.validationStatus},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.validation.feedback),1)]),_:1},8,["type"])])):t.createCommentVNode("",!0)}}}),ly={class:"flex flex-col gap-4"},cy={class:"flex flex-col gap-2"},dy={class:"mt-8 font-bold"},uy={class:"grid grow grid-cols-2 items-start gap-2"},fy={key:2,class:"text-red-500 text-sm"},hy={key:3,class:"text-red-500 text-sm mb-2"},my={class:"flex flex-col gap-4"},py={key:1},gy={class:"text-lg font-semibold"},yy={class:"flex gap-3"},by={},_y=t.defineComponent({...by,__name:"kozyrek-configurator-params-form",props:{value:{},settings:{},previewParams:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},selectTemplateIndex:{}},emits:["update:value","update:params","submit","click:add-line","click:remove-line","click:save-template"],setup(n,{expose:e,emit:i}){var b;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(!1),l=t.ref(M.cloneDeep(r.value)),c=t.computed(()=>{var _,k,x;const y={"configuratorParams.length":[le.required,le.min(r.settings.stripMinLength),le.max(r.settings.stripMaxLength||Number.MAX_VALUE),le.step(r.settings.lengthStep),He.serverValidation((_=r.validation.length)==null?void 0:_.feedback)],quantity:[le.required,le.min(1),le.step(1),He.serverValidation((k=r.validation.quantity)==null?void 0:k.feedback)],marker:[He.serverValidation((x=r.validation.marker)==null?void 0:x.feedback)]};return M.forEach(l.value.configuratorParams.linesWidths,(v,B)=>{var C;const T=l.value.configuratorParams.linesWidths.length>1?r.settings.minLineWidth:r.settings.stripMinWidth;y[`configuratorParams.linesWidths.${B}`]=[le.required,le.min(T),le.max(r.settings.maxLineWidth),le.step(r.settings.lineWidthStep),He.serverValidation((C=r.validation[`lines_widths[${B+1}]`])==null?void 0:C.feedback)]}),M.forEach(l.value.configuratorParams.linesAngles,(v,B)=>{var w;y[`configuratorParams.linesAngles.${B}`]=[le.required,le.min(r.settings.minLineAngle),le.max(r.settings.maxLineAngle),le.step(r.settings.lineAngleStep),He.serverValidation((w=r.validation[`lines_angles[${B+1}]`])==null?void 0:w.feedback)]}),y}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>{var v;const{length:y}=l.value.configuratorParams,{quantity:_}=l.value,k=((v=l.value.product)==null?void 0:v.costRub)||0;if(!y||!_||k===0)return null;const x=y/1e3;return(k*_*x).toLocaleString("ru-ru",{maximumFractionDigits:2,minimumFractionDigits:2})}),f=t.computed(()=>M.reduce(l.value.configuratorParams.linesWidths,(y,_)=>y+(_||0),0)),h=t.computed(()=>{const y=f.value;return y>=r.settings.stripMinWidth&&y<=r.settings.stripMaxWidth}),p=t.computed(()=>{const{configuratorParams:y}=l.value,_=M.every(y.linesWidths,B=>!!(B&&B>0)),k=M.every(y.linesAngles,B=>!M.isNil(B)),x=!!(l.value.quantity&&l.value.quantity>0),v=y.length>0&&y.length>0;return _&&k&&x&&v&&h.value}),m=()=>{t.nextTick(()=>{var y;(y=s.value)==null||y.validate(_=>{_||(o("update:params",l.value.configuratorParams),g("configuratorParams",l.value.configuratorParams))}).catch(M.noop)})},g=(y,_)=>{const k=new j.OrderItemBase(l.value);k[y]=_,y==="configuratorParams"&&(k.product=new j.ClientProduct),o("update:value",k)};return t.watch(()=>r.previewParams,y=>{l.value.configuratorParams.linesWidths=y.linesWidths,l.value.configuratorParams.linesAngles=y.linesAngles},{deep:!0}),t.watch(()=>r.value,y=>{l.value=M.cloneDeep(y)},{deep:!0}),e({validate:(b=s.value)==null?void 0:b.validate,formReference:s}),(y,_)=>{const k=ac,x=fo,v=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:l.value,rules:c.value,class:"flex flex-col gap-4 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var B;return[t.createElementVNode("div",ly,[_[21]||(_[21]=t.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),n.settings.startTailConfigs&&n.settings.startTailConfigs.length>0?(t.openBlock(),t.createBlock(t.unref(F.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:l.value.configuratorParams.startTailType,"onUpdate:value":[_[0]||(_[0]=w=>l.value.configuratorParams.startTailType=w),m],options:n.settings.startTailConfigs.map(({label:w},T)=>({label:w,value:T})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",cy,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value.configuratorParams.linesAngles,(w,T)=>(t.openBlock(),t.createElementBlock("div",{key:T,class:"flex items-start gap-2"},[t.createElementVNode("div",dy,t.toDisplayString(T+1),1),t.createElementVNode("div",uy,[t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.linesWidths.${T}`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.configuratorParams.linesWidths[T],"onUpdate:value":[C=>l.value.configuratorParams.linesWidths[T]=C,_[2]||(_[2]=C=>m())],parse:t.unref(ct),"show-button":!1,class:"w-full",onKeydown:_[1]||(_[1]=C=>t.unref(lt)(C)),onInput:C=>t.unref(ot)(n.validation,`lines_widths[${T+1}]`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.linesAngles.${T}`,label:"Угол сгиба, °"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.configuratorParams.linesAngles[T],"onUpdate:value":[C=>l.value.configuratorParams.linesAngles[T]=C,_[4]||(_[4]=C=>m())],parse:t.unref(ct),"show-button":!1,class:"w-full",onKeydown:_[3]||(_[3]=C=>t.unref(lt)(C,!0)),onInput:C=>t.unref(ot)(n.validation,`lines_angles[${T+1}]`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(F.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:t.withCtx(()=>[n.settings.showOnlyTemplates?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,size:"medium",onClick:C=>o("click:add-line",T)},{default:t.withCtx(()=>[t.createVNode(k)]),_:1},8,["onClick"])),n.settings.showOnlyTemplates?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:1,disabled:l.value.configuratorParams.linesWidths.length===1,size:"medium",class:"ml-2",onClick:C=>o("click:remove-line",T)},{default:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["disabled","onClick"]))]),_:2},1024)]))),128))]),n.settings.endTailConfigs&&n.settings.endTailConfigs.length>0?(t.openBlock(),t.createBlock(t.unref(F.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:l.value.configuratorParams.endTailType,"onUpdate:value":[_[5]||(_[5]=w=>l.value.configuratorParams.endTailType=w),m],options:n.settings.endTailConfigs.map(({label:w},T)=>({label:w,value:T})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):t.createCommentVNode("",!0),t.createVNode($r,{"is-product-searching":n.isProductSearching,product:l.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),h.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",fy," Суммарная ширина участков гиба должна быть от "+t.toDisplayString(n.settings.stripMinWidth)+" до "+t.toDisplayString(n.settings.stripMaxWidth)+" мм., текущая ширина: "+t.toDisplayString(f.value)+" мм. ",1)),p.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",hy," Пожалуйста, заполните все обязательные поля корректно. ")),n.settings.allowSaveTemplates&&n.selectTemplateIndex===((B=n.settings.allTemplates)==null?void 0:B.length)-1?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:4,type:"tertiary",class:"self-start",loading:a.value,onClick:_[6]||(_[6]=w=>o("click:save-template"))},{default:t.withCtx(()=>[..._[20]||(_[20]=[t.createTextVNode(" Сохранить шаблон ",-1)])]),_:1},8,["loading"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",my,[t.createVNode(t.unref(F.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:l.value.configuratorParams.colorSide,"onUpdate:value":[_[7]||(_[7]=w=>l.value.configuratorParams.colorSide=w),m],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"configuratorParams.length",label:`Метраж${n.settings.stripMinLength?" от "+n.settings.stripMinLength:""}${n.settings.stripMaxLength?" до "+n.settings.stripMaxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[_[8]||(_[8]=w=>l.value.configuratorParams.length=w),_[11]||(_[11]=w=>m())],parse:t.unref(ct),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:_[9]||(_[9]=w=>t.unref(lt)(w)),onInput:_[10]||(_[10]=w=>t.unref(ot)(n.validation,"length")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.quantity,"onUpdate:value":[_[12]||(_[12]=w=>l.value.quantity=w),_[15]||(_[15]=w=>g("quantity",w??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:_[13]||(_[13]=w=>t.unref(lt)(w,!1)),onInput:_[14]||(_[14]=w=>t.unref(ot)(n.validation,"quantity")),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:l.value.marker??null,placeholder:"Введите маркировку",onInput:_[16]||(_[16]=w=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":_[17]||(_[17]=w=>{l.value.marker=w??null,g("marker",w??null)}),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(v,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":_[18]||(_[18]=w=>{l.value.isAdditionalSale=w??!1,g("isAdditionalSale",w??!1)})},{default:t.withCtx(()=>[..._[22]||(_[22]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("div",py,[_[23]||(_[23]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",gy,t.toDisplayString(u.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",yy,[t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:!p.value||l.value.product.isNewRec(),type:"primary",class:"self-start",onClick:_[19]||(_[19]=w=>o("submit",l.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])])]}),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",l.value)]])}}}),lc=fn(_y,[["__scopeId","data-v-ac7f1192"]]);var cc=Object.defineProperty,wy=Object.defineProperties,xy=Object.getOwnPropertyDescriptors,dc=Object.getOwnPropertySymbols,ky=Object.prototype.hasOwnProperty,Cy=Object.prototype.propertyIsEnumerable,uc=n=>{throw TypeError(n)},Fs=(n,e,i)=>e in n?cc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,Er=(n,e)=>{for(var i in e||(e={}))ky.call(e,i)&&Fs(n,i,e[i]);if(dc)for(var i of dc(e))Cy.call(e,i)&&Fs(n,i,e[i]);return n},Vs=(n,e)=>wy(n,xy(e)),fc=(n,e)=>{for(var i in e)cc(n,i,{get:e[i],enumerable:!0})},S=(n,e,i)=>Fs(n,typeof e!="symbol"?e+"":e,i),hc=(n,e,i)=>e.has(n)||uc("Cannot "+i),Lt=(n,e,i)=>(hc(n,e,"read from private field"),i?i.call(n):e.get(n)),mc=(n,e,i)=>e.has(n)?uc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,i),vy=(n,e,i,r)=>(hc(n,e,"write to private field"),e.set(n,i),i),Ft={Image:null,isHeadless:!1,shim:function(n,e){return n.tagName=n.nodeName=e||"canvas",n.nodeType=1,n.getAttribute=function(i){return this[i]},n.setAttribute=function(i,r){return this[i]=r,this},n},polyfill:function(n,e){return Ft.shim(n),typeof e<"u"&&(Ft.Image=e),Ft.isHeadless=!0,n}},pc={};fc(pc,{Curve:()=>Qi,getAnchorsFromArcData:()=>Ny,getComponentOnCubicBezier:()=>Rr,getControlPoints:()=>Bc,getCurveBoundingBox:()=>Cc,getCurveFromPoints:()=>Sc,getCurveLength:()=>kc,getReflection:()=>Os,integrate:()=>vc,subdivide:()=>As});var gc={};fc(gc,{HALF_PI:()=>dt,NumArray:()=>Cn,TWO_PI:()=>tt,decomposeMatrix:()=>ki,getComputedMatrix:()=>Ms,getEffectiveStrokeWidth:()=>vn,getPoT:()=>_c,lerp:()=>Vt,mod:()=>st,setMatrix:()=>bc,toFixed:()=>Oe});var Ke;typeof window<"u"?Ke=window:typeof global<"u"?Ke=global:typeof self<"u"&&(Ke=self);var yc,tt=Math.PI*2,dt=Math.PI*.5;function ki(n,e,i,r,o,s){let a;return arguments.length<=1?(a=n.a,e=n.b,i=n.c,r=n.d,o=n.e,s=n.f):a=n,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function bc(n){yc=n}function Ms(n,e){e=e&&e.identity()||new yc;let i=n;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Vt(n,e,i){return i*(e-n)+n}var Is=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function _c(n){let e=0;for(;Is[e]&&Is[e]<n;)e++;return Is[e]}function st(n,e){for(;n<0;)n+=e;return n%e}var Cn=Ke.Float32Array||Array,Sy=Math.floor;function Oe(n){return Sy(n*1e6)/1e6}function vn(n,e){const i=n._linewidth;if(n.strokeAttenuation)return i;e||(e=n.worldMatrix||Ms(n));const r=ki(e.elements[0],e.elements[3],e.elements[1],e.elements[4],e.elements[2],e.elements[5]),o=Math.max(Math.abs(r.scaleX),Math.abs(r.scaleY));return o>0?i/o:i}var ne={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},ee=class{constructor(){S(this,"_events",{}),S(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(i)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,i!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}};S(ee,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),S(ee,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var wc={x:{enumerable:!0,get:function(){return this._x},set:function(n){this._x!==n&&(this._x=n,this._bound&&this.dispatchEvent(ee.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(n){this._y!==n&&(this._y=n,this._bound&&this.dispatchEvent(ee.Types.change))}}},hn=class _r extends ee{constructor(e=0,i=0){super(),S(this,"_x",0),S(this,"_y",0);for(let r in wc)Object.defineProperty(this,r,wc[r]);this.x=e,this.y=i}static add(e,i){return new _r(e.x+i.x,e.y+i.y)}static sub(e,i){return new _r(e.x-i.x,e.y-i.y)}static subtract(e,i){return _r.sub(e,i)}static ratioBetween(e,i){return(e.x*i.x+e.y*i.y)/(e.length()*i.length())}static angleBetween(e,i){if(arguments.length>=4){const s=arguments[0]-arguments[2],a=arguments[1]-arguments[3];return Math.atan2(a,s)}const r=e.x-i.x,o=e.y-i.y;return Math.atan2(o,r)}static distanceBetween(e,i){return Math.sqrt(_r.distanceBetweenSquared(e,i))}static distanceBetweenSquared(e,i){const r=e.x-i.x,o=e.y-i.y;return r*r+o*o}set(e,i){return this.x=e,this.y=i,this}copy(e){return this.x=e.x,this.y=e.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new _r(this.x,this.y)}add(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x+=e,this.y+=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=i),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x-=e,this.y-=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=i),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(e){return this.sub.apply(this,arguments)}subtractSelf(e){return this.sub.apply(this,arguments)}multiply(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x*=e,this.y*=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=i),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x/=e,this.y/=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=i),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(e){return this.divide.apply(this,arguments)}divideScalar(e){return this.divide(e)}negate(){return this.multiply(-1)}dot(e){return this.x*e.x+this.y*e.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const i=this.x-e.x,r=this.y-e.y;return i*i+r*r}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,i){return i=typeof i>"u"?1e-4:i,this.distanceTo(e)<i}lerp(e,i){const r=(e.x-this.x)*i+this.x,o=(e.y-this.y)*i+this.y;return this.set(r,o)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:Oe(this.x),y:Oe(this.y)}}rotate(e){const i=this.x,r=this.y,o=Math.cos(e),s=Math.sin(e);return this.x=i*o-r*s,this.y=i*s+r*o,this}};S(hn,"zero",new hn),S(hn,"left",new hn(-1,0)),S(hn,"right",new hn(1,0)),S(hn,"up",new hn(0,-1)),S(hn,"down",new hn(0,1));var re=hn,Ee=class ws extends re{constructor(e=0,i=0,r=0,o=0,s=0,a=0,l=ne.move){super(e,i),S(this,"controls",{left:new re,right:new re}),S(this,"_command",ne.move),S(this,"_relative",!0),S(this,"_rx",0),S(this,"_ry",0),S(this,"_xAxisRotation",0),S(this,"_largeArcFlag",0),S(this,"_sweepFlag",1);for(let d in xc)Object.defineProperty(this,d,xc[d]);this.command=l,this.relative=!0;const c=ws.makeBroadcast(this);this.controls.left.set(r,o).addEventListener(ee.Types.change,c),this.controls.right.set(s,a).addEventListener(ee.Types.change,c)}static makeBroadcast(e){return i;function i(){e._bound&&e.dispatchEvent(ee.Types.change)}}static fromObject(e){return new ws().copy(e)}copy(e){return this.x=e.x,this.y=e.y,typeof e.command=="string"&&(this.command=e.command),e.controls&&(e.controls.left&&this.controls.left.copy(e.controls.left),e.controls.right&&this.controls.right.copy(e.controls.right)),typeof e.relative=="boolean"&&(this.relative=e.relative),typeof e.rx=="number"&&(this.rx=e.rx),typeof e.ry=="number"&&(this.ry=e.ry),typeof e.xAxisRotation=="number"&&(this.xAxisRotation=e.xAxisRotation),typeof e.largeArcFlag=="number"&&(this.largeArcFlag=e.largeArcFlag),typeof e.sweepFlag=="number"&&(this.sweepFlag=e.sweepFlag),this}clone(){return new ws().copy(this)}toObject(){return{x:Oe(this.x),y:Oe(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Oe(this.rx),ry:Oe(this.ry),xAxisRotation:Oe(this.xAxisRotation),largeArcFlag:Oe(this.largeArcFlag),sweepFlag:Oe(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},xc={command:{enumerable:!0,get:function(){return this._command},set:function(n){this._command!==n&&(this._command=n,this._bound&&this.dispatchEvent(ee.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(n){this._relative!==!!n&&(this._relative=!!n,this._bound&&this.dispatchEvent(ee.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(n){this._rx!==n&&(this._rx=n,this._bound&&this.dispatchEvent(ee.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(n){this._ry!==n&&(this._ry=n,this._bound&&this.dispatchEvent(ee.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(n){this._xAxisRotation!==n&&(this._xAxisRotation=n,this._bound&&this.dispatchEvent(ee.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(n){this._largeArcFlag!==n&&(this._largeArcFlag=n,this._bound&&this.dispatchEvent(ee.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(n){this._sweepFlag!==n&&(this._sweepFlag=n,this._bound&&this.dispatchEvent(ee.Types.change))}}},By=0,Ct={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.23",PublishDate:"2025-12-22T19:59:24.486Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return By++}},Qi={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Rr(n,e,i,r,o){const s=1-n;return s*s*s*e+3*s*s*n*i+3*s*n*n*r+n*n*n*o}function As(n,e,i,r,o,s,a,l,c){c=c||Qi.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ee(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Rr(h,n,i,o,a),m=Rr(h,e,r,s,l);u.push(new Ee(p,m))}return u}function kc(n,e,i,r,o,s,a,l,c){if(n===i&&e===r&&o===a&&s===l){const b=a-n,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(a-n),u=6*(n+o)-12*i,f=3*(i-n),h=9*(r-s)+3*(l-e),p=6*(e+s)-12*r,m=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+p)*b+m;return Math.sqrt(y*y+_*_)}return vc(g,0,1,c||Qi.RecursionLimit)}function Cc(n,e,i,r,o,s,a,l){const c=[],d=[[],[]];let u,f,h,p,m,g,b,y;for(let v=0;v<2;++v){if(v===0?(f=6*n-12*i+6*o,u=-3*n+9*i-9*o+3*a,h=3*i-3*n):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;p=-h/f,0<p&&p<1&&c.push(p);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(m=(-f+y)/(2*u),0<m&&m<1&&c.push(m),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)p=c[_],x=1-p,d[0][_]=x*x*x*n+3*x*x*p*i+3*x*p*p*o+p*p*p*a,d[1][_]=x*x*x*e+3*x*x*p*r+3*x*p*p*s+p*p*p*l;return d[0][k]=n,d[1][k]=e,d[0][k+1]=a,d[1][k+1]=l,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function vc(n,e,i,r){let o=Qi.abscissas[r-2],s=Qi.weights[r-2],a=.5*(i-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*n(l):0;for(;c<d;){const f=a*o[c];u+=s[c++]*(n(l+f)+n(l-f))}return a*u}function Sc(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?st(o-1,i):Math.max(o-1,0),l=e?st(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];Bc(c,d,u),d.command=o===0?ne.move:ne.curve}}function Bc(n,e,i){const r=re.angleBetween(n,e),o=re.angleBetween(i,e);let s=re.distanceBetween(n,e),a=re.distanceBetween(i,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=dt:l-=dt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}function Os(n,e,i){return new re(2*n.x-(e.x+n.x)-(i?n.x:0),2*n.y-(e.y+n.y)-(i?n.y:0))}function Ny(n,e,i,r,o,s,a){const l=Ct.Resolution;for(let c=0;c<l;c++){let d=(c+1)/l;a&&(d=1-d);const u=d*s+o,f=i*Math.cos(u),h=r*Math.sin(u),p=new Ee(f,h);p.command=ne.line}}var Nc=Array.prototype.slice;function Ty(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}var oe={isNaN:function(n){return typeof n=="number"&&n!==+n},isElement:function(n){return!!(n&&n.nodeType===1)},isObject:function(n){const e=typeof n;return e==="function"||e==="object"&&!!n},isFunction:function(n){return typeof n=="function"},extend:function(n){const e=Nc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]=r[o]}return n},defaults:function(n){const e=Nc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]===void 0&&(n[o]=r[o])}return n},each:function(n,e,i){const r=i||this,o=!Ty(n)&&Object.keys(n),s=(o||n).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,n[l],l,n)}return n},performance:Ke.performance&&Ke.performance.now?Ke.performance:Date},Gt={hasEventListeners:typeof Ke.addEventListener=="function",bind:function(n,e,i,r){return this.hasEventListeners?n.addEventListener(e,i,!!r):n.attachEvent("on"+e,i),Gt},unbind:function(n,e,i,r){return Gt.hasEventListeners?n.removeEventListeners(e,i,!!r):n.detachEvent("on"+e,i),Gt},getRequestAnimationFrame:function(){const n=["ms","moz","webkit","o"];let e=0,i=Ke.requestAnimationFrame;if(!i){for(let o=0;o<n.length;o++)i=Ke[n[o]+"RequestAnimationFrame"]||i;i=i||r}function r(o,s){const a=new Date().getTime(),l=Math.max(0,16-(a-e)),c=Ke.setTimeout(d,l);e=a+l;function d(){o(a+l)}return c}return i}},Ji=Ke.document?Ke.document.createElement("div"):{};Ji.id="help-two-load",Object.defineProperty(Gt,"temp",{enumerable:!0,get:function(){return oe.isElement(Ji)&&!Ke.document.head.contains(Ji)&&(Ji.style.display="none",Ke.document.head.appendChild(Ji)),Ji}});var Ht=class extends Error{constructor(e){super(),S(this,"name","Two.js"),S(this,"message"),this.message=e}},$y=Ke.devicePixelRatio||1;function Ey(n){return n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1}function zs(n){return $y/Ey(n)}var ho=class{constructor(){S(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}},vt,li=class extends Array{constructor(){super(),mc(this,vt,new ee),arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return Lt(this,vt)}set _events(e){vy(this,vt,e)}get _bound(){return Lt(this,vt)._bound}set _bound(e){Lt(this,vt)._bound=e}addEventListener(){var e;return(e=Lt(this,vt).addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=Lt(this,vt).on)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=Lt(this,vt).bind)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=Lt(this,vt).removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=Lt(this,vt).off)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=Lt(this,vt).unbind)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=Lt(this,vt).dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=Lt(this,vt).trigger)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=Lt(this,vt).listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=Lt(this,vt).ignore)==null?void 0:e.apply(this,arguments)}pop(){const e=super.pop.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}shift(){const e=super.shift.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}push(){const e=super.push.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}unshift(){const e=super.unshift.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}splice(){const e=super.splice.apply(this,arguments);if(this.trigger(ee.Types.remove,e),arguments.length>2){const i=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ee.Types.insert,i),this.trigger(ee.Types.order)}return e}sort(){return super.sort.apply(this,arguments),this.trigger(ee.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ee.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(e,i){const r=[];for(let o=0;o<this.length;o++){const s=this[o];let a;i?a=e.call(i,s,o):a=e(s,o),r.push(a)}return r}};vt=new WeakMap;var Tc=class vm extends ee{constructor(){super(),S(this,"_flagId",!1),S(this,"_flagClassName",!1),S(this,"_renderer",{}),S(this,"_id",Ct.Identifier+Ct.uniqueId()),S(this,"_className",""),S(this,"classList",[]);for(let e in $c)Object.defineProperty(this,e,$c[e])}static fromObject(e){const i=new vm().copy(e);return"id"in e&&(i.id=e.id),i}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return e.renderer&&typeof e.renderer.type=="string"&&(this.renderer.type=e.renderer.type),typeof e.className=="string"&&(this.className=e.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const i=this.renderer.ctx;this._renderer.texture&&(i.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(i.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const e=this._renderer.type;return this._renderer={type:e},this}};S(Tc,"Properties",["renderer","id","className"]);var er=Tc,$c={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(n){const e=this._id;n!==this._id&&(this._id=n,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(n){this._className!==n&&(this._flagClassName=!0,this.classList=n.split(/\s+?/),this._className=n)}}},mo,Ec={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Ke.document&&(mo=document.createElement("a"));var mn=class tn extends er{constructor(e,i){super(),S(this,"_flagSrc",!1),S(this,"_flagImage",!1),S(this,"_flagVideo",!1),S(this,"_flagLoaded",!1),S(this,"_flagRepeat",!1),S(this,"_flagOffset",!1),S(this,"_flagScale",!1),S(this,"_src",""),S(this,"_image",null),S(this,"_loaded",!1),S(this,"_repeat","no-repeat"),S(this,"_scale",1),S(this,"_offset",null);for(let r in Rc)Object.defineProperty(this,r,Rc[r]);if(this._renderer.type="texture",this._renderer.flagOffset=Ry.bind(this),this._renderer.flagScale=Py.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new re,typeof i=="function"){const r=(function(){this.unbind(ee.Types.load,r),typeof i=="function"&&i()}).bind(this);this.bind(ee.Types.load,r)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const r=Object.prototype.toString.call(e);(r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]"||r==="[object HTMLVideoElement]"||r==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const i=new tn().copy(e);return"id"in e&&(i.id=e.id),i}static getAbsoluteURL(e){return mo?(mo.href=e,mo.href):e}static loadHeadlessBuffer(e,i){e.image.onload=i,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const i=tn.getAbsoluteURL(e);if(tn.ImageRegistry.contains(i))return tn.ImageRegistry.get(i);let r;return Ft.Image?(r=new Ft.Image,Ft.shim(r,"img")):Ke.document?Ec.video.test(i)?r=document.createElement("video"):r=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r.referrerPolicy="no-referrer",r}static load(e,i){let r=e.image,o=tn.getTag(r);e._flagImage&&(/canvas/i.test(o)?tn.Register.canvas(e,i):(e._src=!Ft.isHeadless&&r.getAttribute("two-src")||r.src,tn.Register[o](e,i))),e._flagSrc&&(r||(r=tn.getImage(e.src),e.image=r),o=tn.getTag(r),tn.Register[o](e,i))}clone(){const e=new tn(this.src);return e.repeat=this.repeat,e.offset.copy(this.offset),e.scale=this.scale,e}copy(e){return this.src=e.src,this.repeat=e.repeat,this.offset=typeof e.offset=="number"||e.offset instanceof re?e.offset:new re().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re().copy(e.scale),this}toObject(){const e=super.toObject.call(this);return e.renderer.type="texture",e.src=this.src,e.repeat=this.repeat,e.offset=this.offset.toObject(),e.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),e}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(ee.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,tn.load(this,(function(){this.loaded=!0,this.trigger(ee.Types.change).trigger(ee.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(mn,"Properties",["src","loaded","repeat","scale","offset","image"]),S(mn,"RegularExpressions",Ec),S(mn,"ImageRegistry",new ho),S(mn,"Register",{canvas:function(n,e){n._src="#"+n.id,mn.ImageRegistry.add(n.src,n.image),typeof e=="function"&&e()},img:function(n,e){const i=n.image,r=function(s){!Ft.isHeadless&&i.removeEventListener&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),typeof e=="function"&&e()},o=function(s){throw!Ft.isHeadless&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),new Ht("unable to load "+n.src)};typeof i.width=="number"&&i.width>0&&typeof i.height=="number"&&i.height>0?r():!Ft.isHeadless&&typeof i.addEventListener=="function"&&(i.addEventListener("load",r,!1),i.addEventListener("error",o,!1)),n._src=mn.getAbsoluteURL(n._src),!(!Ft.isHeadless&&i&&i.getAttribute("two-src"))&&(Ft.isHeadless||i.setAttribute("two-src",n.src),mn.ImageRegistry.add(n.src,i),Ft.isHeadless?mn.loadHeadlessBuffer(n,r):n.image.src=n.src)},video:function(n,e){if(Ft.isHeadless)throw new Ht("video textures are not implemented in headless environments.");const i=function(o){n.image.removeEventListener("canplaythrough",i,!1),n.image.removeEventListener("error",r,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof e=="function"&&e()},r=function(o){throw n.image.removeEventListener("canplaythrough",i,!1),n.image.removeEventListener("error",r,!1),new Ht("unable to load "+n.src)};n._src=mn.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),mn.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?i():(n.image.addEventListener("canplaythrough",i,!1),n.image.addEventListener("error",r,!1),n.image.src=n.src,n.image.load())}});var ze=mn,Rc={src:{enumerable:!0,get:function(){return this._src},set:function(n){this._src=n,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(n){this._loaded=n,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(n){this._repeat=n,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(n){const e=ze.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}ze.ImageRegistry.contains(i)?this._image=ze.ImageRegistry.get(n.src):this._image=n,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset&&this._offset.unbind(ee.Types.change,this._renderer.flagOffset),this._offset=n,this._offset.bind(ee.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Ry(){this._flagOffset=!0}function Py(){this._flagScale=!0}var Ds=class kn extends er{constructor(e,i,r){super(),S(this,"_flagOffset",!0),S(this,"_flagOpacity",!0),S(this,"_flagColor",!0),S(this,"_offset",0),S(this,"_opacity",1),S(this,"_color","#fff");for(let o in Pc)Object.defineProperty(this,o,Pc[o]);this._renderer.type="stop",this.offset=typeof e=="number"?e:kn.Index<=0?0:1,this.opacity=typeof r=="number"?r:1,this.color=typeof i=="string"?i:kn.Index<=0?"#fff":"#000",kn.Index=(kn.Index+1)%2}static fromObject(e){const i=new kn().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<kn.Properties.length;i++){const r=kn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new kn;return oe.each(kn.Properties,function(r){i[r]=this[r]},this),e&&e.stops&&e.stops.push(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",oe.each(kn.Properties,i=>{e[i]=this[i]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};S(Ds,"Index",0),S(Ds,"Properties",["offset","opacity","color"]);var ci=Ds,Pc={offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset=n,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(n){this._color=n,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Ls=class ji extends er{constructor(e){super(),S(this,"_flagStops",!1),S(this,"_flagSpread",!1),S(this,"_flagUnits",!1),S(this,"_spread",""),S(this,"_units","");for(let i in Fc)Object.defineProperty(this,i,Fc[i]);this._renderer.type="gradient",this._renderer.flagStops=Fy.bind(this),this._renderer.bindStops=Vy.bind(this),this._renderer.unbindStops=My.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let i=e.stops;i&&i.length>0&&(i=i.map(o=>o instanceof ci?o:new ci().copy(o)));const r=new ji(i).copy(e);return"id"in e&&(r.id=e.id),r}clone(e){const i=this.stops.map(o=>o.clone()),r=new ji(i);return oe.each(ji.Properties,o=>{r[o]=this[o]},this),e&&e.add(r),r}copy(e){super.copy.call(this,e);for(let i=0;i<ji.Properties.length;i++){const r=ji.Properties[i];r in e&&(this[r]=e[r])}return this}toObject(){const e={stops:this.stops.map(i=>i.toObject())};return oe.each(ji.Properties,i=>{e[i]=this[i]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(Ls,"Stop",ci),S(Ls,"Properties",["spread","stops","units"]);var ut=Ls,Fc={spread:{enumerable:!0,get:function(){return this._spread},set:function(n){this._spread=n,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(n){this._units=n,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(n){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._stops=new li((n||[]).slice(0)),this._stops.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._stops)}}};function Fy(){this._flagStops=!0}function Vy(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function My(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}var Hs=class to extends ut{constructor(e,i,r,o,s){super(s),S(this,"_flagEndPoints",!1),S(this,"_left",null),S(this,"_right",null);for(let a in Vc)Object.defineProperty(this,a,Vc[a]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Iy.bind(this),this.left=new re,this.right=new re,typeof e=="number"&&(this.left.x=e),typeof i=="number"&&(this.left.y=i),typeof r=="number"&&(this.right.x=r),typeof o=="number"&&(this.right.y=o)}static fromObject(e){const i=new to().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<to.Properties.length;i++){const r=to.Properties[i];r in e&&(this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new to(this.left._x,this.left._y,this.right._x,this.right._y,i);return oe.each(ut.Properties,function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};S(Hs,"Stop",ci),S(Hs,"Properties",["left","right"]);var Ge=Hs,Vc={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof re&&this._left.unbind(ee.Types.change,this._renderer.flagEndPoints),this._left=n,this._left.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(n){this._right instanceof re&&this._right.unbind(ee.Types.change,this._renderer.flagEndPoints),this._right=n,this._right.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function Iy(){this._flagEndPoints=!0}var Ws=class qi extends ut{constructor(e,i,r,o,s,a){super(o),S(this,"_flagRadius",!1),S(this,"_flagCenter",!1),S(this,"_flagFocal",!1),S(this,"_radius",0),S(this,"_center",null),S(this,"_focal",null);for(let l in Mc)Object.defineProperty(this,l,Mc[l]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Ay.bind(this),this._renderer.flagFocal=Oy.bind(this),this.center=new re,this.radius=typeof r=="number"?r:1,this.focal=new re,typeof e=="number"&&(this.center.x=e),typeof i=="number"&&(this.center.y=i),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof a=="number"&&(this.focal.y=a)}static fromObject(e){const i=new qi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<qi.Properties.length;i++){const r=qi.Properties[i];r in e&&(/(center|focal)i/.test(r)?this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]):typeof e[r]=="number"&&(this[r]=e[MediaKeySystemAccess]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new qi(this.center._x,this.center._y,this._radius,i,this.focal._x,this.focal._y);return oe.each(ut.Properties.concat(qi.Properties),function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return oe.each(qi.Properties,function(i){e[i]=this[i]},this),e.center=this.center.toObject(),e.focal=this.focal.toObject(),e}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};S(Ws,"Stop",ci),S(Ws,"Properties",["center","radius","focal"]);var Ze=Ws,Mc={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(n){this._center&&this._center.unbind(ee.Types.change,this._renderer.flagCenter),this._center=n,this._center.bind(ee.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(n){this._focal&&this._focal.unbind(ee.Types.change,this._renderer.flagFocal),this._focal=n,this._focal.bind(ee.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function Ay(){this._flagCenter=!0}function Oy(){this._flagFocal=!0}function Ic(n,e){if(e===0||e===1)return!0;const r=n._length*e;let o=0;for(let s=0;s<n._lengths.length;s++){const a=n._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function po(n,e){const i=n._length;if(e<=0)return 0;if(e>=i)return n._lengths.length-1;for(let r=0,o=0;r<n._lengths.length;r++){if(o+n._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/n._lengths[r];o+=n._lengths[r]}return-1}function Ac(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),kc(r,l,o,c,s,d,a,u,i)}function js(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),As(r,l,o,c,s,d,a,u,i)}function Ci(n){switch(n.renderer.type){case"texture":return ze.fromObject(n);case"gradient":return ut.fromObject(n);case"linear-gradient":return Ge.fromObject(n);case"radial-gradient":return Ze.fromObject(n)}return n}var zy=Math.cos,Dy=Math.sin,Oc=Math.tan,qs=[],zc=class nn extends ee{constructor(e,i,r,o,s,a){super(),S(this,"elements",new Cn(9)),S(this,"manual",!1);let l=e;Array.isArray(l)||(l=Array.prototype.slice.call(arguments)),this.identity(),l.length>0&&this.set(l)}static Multiply(e,i,r){if(i.length<=3){const B=e;let w,T,C;const $=i[0]||0,E=i[1]||0,I=i[2]||0;return w=B[0]*$+B[1]*E+B[2]*I,T=B[3]*$+B[4]*E+B[5]*I,C=B[6]*$+B[7]*E+B[8]*I,[w,T,C]}const o=e[0],s=e[1],a=e[2],l=e[3],c=e[4],d=e[5],u=e[6],f=e[7],h=e[8],p=i[0],m=i[1],g=i[2],b=i[3],y=i[4],_=i[5],k=i[6],x=i[7],v=i[8];return r=r||new Cn(9),r[0]=o*p+s*b+a*k,r[1]=o*m+s*y+a*x,r[2]=o*g+s*_+a*v,r[3]=l*p+c*b+d*k,r[4]=l*m+c*y+d*x,r[5]=l*g+c*_+d*v,r[6]=u*p+f*b+h*k,r[7]=u*m+f*y+h*x,r[8]=u*g+f*_+h*v,r}static fromObject(e){return new nn().copy(e)}set(e,i,r,o,s,a,l,c,d){if(typeof i>"u"){const u=e;e=u[0],i=u[1],r=u[2],o=u[3],s=u[4],a=u[5],l=u[6],c=u[7],d=u[8]}return this.elements[0]=e,this.elements[1]=i,this.elements[2]=r,this.elements[3]=o,this.elements[4]=s,this.elements[5]=a,this.elements[6]=l,this.elements[7]=c,this.elements[8]=d,this.trigger(ee.Types.change)}copy(e){return this.elements[0]=e.elements[0],this.elements[1]=e.elements[1],this.elements[2]=e.elements[2],this.elements[3]=e.elements[3],this.elements[4]=e.elements[4],this.elements[5]=e.elements[5],this.elements[6]=e.elements[6],this.elements[7]=e.elements[7],this.elements[8]=e.elements[8],this.manual=e.manual,this.trigger(ee.Types.change)}identity(){return this.elements[0]=nn.Identity[0],this.elements[1]=nn.Identity[1],this.elements[2]=nn.Identity[2],this.elements[3]=nn.Identity[3],this.elements[4]=nn.Identity[4],this.elements[5]=nn.Identity[5],this.elements[6]=nn.Identity[6],this.elements[7]=nn.Identity[7],this.elements[8]=nn.Identity[8],this.trigger(ee.Types.change)}multiply(e,i,r,o,s,a,l,c,d){if(typeof i>"u")return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(ee.Types.change);if(typeof r>"u"&&(r=1),typeof o>"u"){e=e||0,i=i||0,r=r||0,s=this.elements;const O=s[0]*e+s[1]*i+s[2]*r,U=s[3]*e+s[4]*i+s[5]*r,Q=s[6]*e+s[7]*i+s[8]*r;return[O,U,Q]}const u=this.elements,f=[e,i,r,o,s,a,l,c,d],h=u[0],p=u[1],m=u[2],g=u[3],b=u[4],y=u[5],_=u[6],k=u[7],x=u[8],v=f[0],B=f[1],w=f[2],T=f[3],C=f[4],$=f[5],E=f[6],I=f[7],R=f[8];return this.elements[0]=h*v+p*T+m*E,this.elements[1]=h*B+p*C+m*I,this.elements[2]=h*w+p*$+m*R,this.elements[3]=g*v+b*T+y*E,this.elements[4]=g*B+b*C+y*I,this.elements[5]=g*w+b*$+y*R,this.elements[6]=_*v+k*T+x*E,this.elements[7]=_*B+k*C+x*I,this.elements[8]=_*w+k*$+x*R,this.trigger(ee.Types.change)}inverse(e){const i=this.elements;e=e||new nn;const r=i[0],o=i[1],s=i[2],a=i[3],l=i[4],c=i[5],d=i[6],u=i[7],f=i[8],h=f*l-c*u,p=-f*a+c*d,m=u*a-l*d;let g=r*h+o*p+s*m;return g?(g=1/g,e.elements[0]=h*g,e.elements[1]=(-f*o+s*u)*g,e.elements[2]=(c*o-s*l)*g,e.elements[3]=p*g,e.elements[4]=(f*r-s*d)*g,e.elements[5]=(-c*r+s*a)*g,e.elements[6]=m*g,e.elements[7]=(-u*r+o*d)*g,e.elements[8]=(l*r-o*a)*g,e):null}scale(e,i){return arguments.length<=1&&(i=e),this.multiply(e,0,0,0,i,0,0,0,1)}rotate(e){const i=zy(e),r=Dy(e);return this.multiply(i,-r,0,r,i,0,0,0,1)}translate(e,i){return this.multiply(1,0,e,0,1,i,0,0,1)}skewX(e){const i=Oc(e);return this.multiply(1,i,0,0,1,0,0,0,1)}skewY(e){const i=Oc(e);return this.multiply(1,0,0,i,1,0,0,0,1)}toString(e){return qs.length=0,this.toTransformArray(e,qs),qs.map(Oe).join(" ")}toTransformArray(e,i){const r=this.elements,o=!!i,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],p=r[8];if(o){i[0]=s,i[1]=c,i[2]=f,i[3]=a,i[4]=d,i[5]=h,i[6]=l,i[7]=u,i[8]=p;return}return[s,c,f,a,d,h,l,u,p]}if(o){i[0]=s,i[1]=c,i[2]=a,i[3]=d,i[4]=l,i[5]=u;return}return[s,c,a,d,l,u]}toArray(e,i){const r=this.elements,o=!!i,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],p=r[8];if(o){i[0]=s,i[1]=a,i[2]=l,i[3]=c,i[4]=d,i[5]=u,i[6]=f,i[7]=h,i[8]=p;return}return[s,a,l,c,d,u,f,h,p]}if(o){i[0]=s,i[1]=a,i[2]=l,i[3]=c,i[4]=d,i[5]=u;return}return[s,a,l,c,d,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new nn().copy(this)}};S(zc,"Identity",[1,0,0,0,1,0,0,0,1]);var vi=zc;bc(vi);var Dc=class Al extends er{constructor(){super(),S(this,"_flagMatrix",!0),S(this,"_flagScale",!1),S(this,"_matrix",null),S(this,"_worldMatrix",null),S(this,"_position",null),S(this,"_rotation",0),S(this,"_scale",1),S(this,"_skewX",0),S(this,"_skewY",0);for(let e in go)Object.defineProperty(this,e,go[e]);this._renderer.flagMatrix=Lc.bind(this),this.isShape=!0,this.matrix=new vi,this.worldMatrix=new vi,this.position=new re,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const i=new Al().copy(e);return"id"in e&&(i.id=e.id),i}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return go.position.get.apply(this,arguments)}set translation(e){go.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&"visible"in this&&this.visible===!1||!s&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();return l?e>=l.left-a&&e<=l.right+a&&i>=l.top-a&&i<=l.bottom+a:!1}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof re?this.position=e.position:this.position.copy(e.position)),"rotation"in e&&(this.rotation=e.rotation),"scale"in e&&(this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re(e.scale.x,e.scale.y)),"skewX"in e&&(this.skewX=e.skewX),"skewY"in e&&(this.skewY=e.skewY),"matrix"in e&&e.matrix.manual&&(this.matrix.copy(e.matrix),this.matrix.manual=!0),this}clone(e){const i=new Al;return i.position.copy(this.position),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer={type:"shape"},e.isShape=!0,e.translation=this.translation.toObject(),e.rotation=this.translation.rotation,e.scale=this.scale instanceof re?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(e){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof re?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),e&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};S(Dc,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var Hn=Dc,go={position:{enumerable:!0,get:function(){return this._position},set:function(n){this._position&&this._position.unbind(ee.Types.change,this._renderer.flagMatrix),this._position=n,this._position.bind(ee.Types.change,this._renderer.flagMatrix),Lc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(n){this._rotation=n,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(n){this._skewX=n,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(n){this._skewY=n,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(n){this._matrix=n,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Ms(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function Lc(){this._flagMatrix=!0}var Hc=/^(?:none|transparent)$/i,Ly=8,Xs=Number.EPSILON;function Wn(n,e){return{x:n,y:e}}function yo(n,e,i=Xs){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function Wc(n,e,i,r){const o=n*i+e*r,s=Math.sqrt(n*n+e*e)*Math.sqrt(i*i+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return n*r-e*i<0&&(a=-a),a}function Hy(n,e,i){if(!n)return[Wn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Wn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=n.x,d=n.y,u=e.x,f=e.y,h=(c-u)/2,p=(d-f)/2,m=Math.cos(s),g=Math.sin(s);let b=m*h+g*p,y=-g*h+m*p,_=r*r,k=o*o;const x=b*b/_+y*y/k;if(x>1){const D=Math.sqrt(x);r*=D,o*=D,_=r*r,k=o*o}const v=_*y*y+k*b*b,B=v===0?0:(_*k-v)/v;let w=Math.sqrt(Math.max(0,B));a===l&&(w=-w);const T=w*r*y/o,C=-w*o*b/r,$=m*T-g*C+(c+u)/2,E=g*T+m*C+(d+f)/2,I=Wc(1,0,(b-T)/r,(y-C)/o),R=Wc((b-T)/r,(y-C)/o,(-b-T)/r,(-y-C)/o)%tt,O=I+R,U=l===0,Q=(()=>{const D=O-I,L=Math.abs(D)<Number.EPSILON;let z=st(D,tt);return z<Number.EPSILON&&(z=L?0:tt),U&&!L&&(z=z===tt?-tt:z-tt),z})(),G=Math.max(Ct.Resolution,Math.max(i*2,1)),W=[];for(let D=1;D<=G;D++){const L=D/G,z=I+L*Q;let P=$+r*Math.cos(z),q=E+o*Math.sin(z);if(s!==0){const K=P-$,J=q-E,Y=Math.cos(s),V=Math.sin(s);P=K*Y-J*V+$,q=K*V+J*Y+E}W.push(Wn(P,q))}return W}function Wy(n,e=Ly){const i=[],r=[],o=n._renderer&&n._renderer.vertices&&n._renderer.vertices.length>0?n._renderer.vertices:n.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(h=!1)=>{if(a){if(h&&l&&c&&!yo(l,c)){const p=Wn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&yo(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}yo(c,h)||(r.push({a:c,b:h}),a&&a.push(h),c=h)};for(let h=0;h<o.length;h++){const p=o[h],m=p.command||(h===0?ne.move:ne.line);if(m===ne.move){u(!1);const g=Wn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===ne.line)f(Wn(p.x,p.y));else if(m===ne.curve){const g=js(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(Wn(y.x,y.y))}f(Wn(p.x,p.y))}else if(m===ne.arc){const g=Hy(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===ne.close){u(!0),d=p;continue}else f(Wn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!yo(l,c);u(h)}return{polygons:i,segments:r}}function jy(n,e,i){let r=!1;for(let o=0;o<n.length;o++){const s=n[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function qy(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<Xs&&Math.abs(s)<Xs){const h=n-i.x,p=e-i.y;return h*h+p*p}const a=((n-i.x)*o+(e-i.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=i.x+l*o,d=i.y+l*s,u=n-c,f=e-d;return u*u+f*f}function Xy(n,e,i){if(!n||n.length===0)return 1/0;let r=1/0;for(let o=0;o<n.length;o++){const s=n[o],a=qy(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function Yy(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!Hc.test(i):!0}function Uy(n,e){const i=typeof n.linewidth=="number"?n.linewidth:n._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=n.stroke;return!r&&r!==0?!1:typeof r=="string"?!Hc.test(r):!0}function Ky(n,e,i,r=0){if(!n)return!1;const o=n.left-r,s=n.right+r,a=n.top-r,l=n.bottom+r;return e>=o&&e<=s&&i>=a&&i<=l}var bo=Number.EPSILON;function _o(n){return typeof n.relative!="boolean"||!!n.relative}function pn(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<bo&&Math.abs(r)<bo){_o(n)?o[e].clear():o[e].set(n.x,n.y);return}_o(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Wt(n,e){pn(n,e,0,0)}function Gy(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:_o(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function tr(n,e){const i=Gy(n,e);return Math.abs(i.x)>bo||Math.abs(i.y)>bo}function wo(n){n.command===ne.move||n.command===ne.close||(n.command=tr(n,"left")||tr(n,"right")?ne.curve:ne.line)}function jc(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function Zy(n,e){return tr(e,"right")||tr(n,"left")||tr(n,"right")||tr(e,"left")||n.command===ne.curve||e.command===ne.curve}function nr(n,e,i){return{x:Vt(n.x,e.x,i),y:Vt(n.y,e.y,i)}}function qc(n,e){const i=n.controls&&n.controls[e];return i?_o(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function Qy(n,e,i){const r=n.controls&&n.controls.right,o=e.controls&&e.controls.left,s={x:n.x,y:n.y},a=r?qc(n,"right"):Er({},s),l={x:e.x,y:e.y},c=o?qc(e,"left"):Er({},l),d=nr(s,a,i),u=nr(a,c,i),f=nr(c,l,i),h=nr(d,u,i),p=nr(u,f,i),m=nr(h,p,i),g=new Ee(m.x,m.y);return jc(g,n),pn(g,"left",h.x-m.x,h.y-m.y),pn(g,"right",p.x-m.x,p.y-m.y),g.command=ne.curve,{anchor:g,startOut:d,endIn:f}}function Jy(n,e,i,r,o,s){const a=n.length,l=i-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,a-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let w=0,T=e-u;w<=c;w+=1,T+=1){const C=st(T,a);h[w]=n[C]}let p=h[0].x+2*h[1].x,m=h[0].y+2*h[1].y,g=2;const b=c-1,y=[p],_=[m],k=[g],x=new Array(c+1),v=new Array(c+1);for(let w=1;w<c;w+=1){const T=w<b,C=T||s?1:2,$=T?4:s?2:7,E=T?4:s?3:8,I=T?2:s?0:1,R=C/g;g=k[w]=$-R,p=y[w]=E*h[w].x+I*h[w+1].x-R*p,m=_[w]=E*h[w].y+I*h[w+1].y-R*m}x[b]=y[b]/k[b],v[b]=_[b]/k[b];for(let w=c-2;w>=0;w-=1)x[w]=(y[w]-x[w+1])/k[w],v[w]=(_[w]-v[w+1])/k[w];x[c]=(3*h[c].x-x[b])/2,v[c]=(3*h[c].y-v[b])/2;const B=c-f;for(let w=u,T=e;w<=B;w+=1,T+=1){const C=st(T,a),$=n[C],E=x[w]-$.x,I=v[w]-$.y;o||w<B?pn($,"right",E,I):Wt($,"right"),o||w>u?pn($,"left",-E,-I):Wt($,"left"),wo($)}}function e0(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=re.distanceBetween(a,l),u=re.distanceBetween(l,c),f=r===void 0?.5:r,h=Math.pow(d,f),p=Math.pow(u,f),m=h*h,g=p*p;if(!o&&e){const b=2*g+3*p*h+m,y=3*p*(p+h);if(y!==0){const _=(g*a.x+b*l.x-m*c.x)/y-l.x,k=(g*a.y+b*l.y-m*c.y)/y-l.y;pn(n,"left",_,k)}else Wt(n,"left")}else Wt(n,"left");if(!s&&i){const b=2*m+3*h*p+g,y=3*h*(h+p);if(y!==0){const _=(m*c.x+b*l.x-g*a.x)/y-l.x,k=(m*c.y+b*l.y-g*a.y)/y-l.y;pn(n,"right",_,k)}else Wt(n,"right")}else Wt(n,"right");wo(n)}function t0(n,e,i,r,o,s){if(!(e&&i)){e||Wt(n,"left"),i||Wt(n,"right"),wo(n);return}const a=e,l=n,c=i,d=re.distanceBetween(a,l),u=re.distanceBetween(l,c),f=d+u,h=r===void 0?.4:r,p={x:a.x-c.x,y:a.y-c.y};if(!o&&f!==0){const m=h*d/f;pn(n,"left",p.x*m,p.y*m)}else Wt(n,"left");if(!s&&f!==0){const m=h*d/f-h;pn(n,"right",p.x*m,p.y*m)}else Wt(n,"right");wo(n)}function n0(n,e,i,r,o,s){const a=s.type,l=s.factor,c=n.length;for(let d=e;d<=i;d+=1){const u=st(d,c),f=n[u];if(f.command===ne.move){Wt(f,"left"),Wt(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[st(h,c)],g=p===null?null:n[st(p,c)],b=h===null,y=p===null;a==="geometric"?t0(f,m,g,l,b,y):e0(f,m,g,l,b,y)}}var ir=Math.min,rr=Math.max,i0=Math.ceil,r0=Math.floor,o0=new re,s0=new vi,Ys=class bi extends Hn{constructor(e,i,r,o){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagCap",!0),S(this,"_flagJoin",!0),S(this,"_flagMiter",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in Xc)Object.defineProperty(this,s,Xc[s]);this._renderer.type="path",this._renderer.flagVertices=Yc.bind(this),this._renderer.bindVertices=Uc.bind(this),this._renderer.unbindVertices=Kc.bind(this),this._renderer.flagFill=Gc.bind(this),this._renderer.flagStroke=Zc.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!i,this.curved=!!r,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=e,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Ci(e.fill),r=typeof e.stroke=="string"?e.stroke:Ci(e.stroke),o=new bi().copy(Vs(Er({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){if(super.copy.call(this,e),e.vertices){this.vertices=[];for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof Ee?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new Ee().copy(r))}}for(let i=0;i<bi.Properties.length;i++){const r=bi.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new bi;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<bi.Properties.length;r++){const o=bi.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(i=>i.toObject()),oe.each(bi.Properties,i=>{typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind(),i.controls&&(i.controls.left&&typeof i.controls.left.unbind=="function"&&i.controls.left.unbind(),i.controls.right&&typeof i.controls.right.unbind=="function"&&i.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),i=e.width/2,r=e.height/2,o=e.left+e.width/2,s=e.top+e.height/2;for(let a=0;a<this.vertices.length;a++){const l=this.vertices[a];l.x-=o,l.y-=s,l.x+=i,l.y+=r}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=i,this.mask.translation.y-=s,this.mask.translation.y+=r),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o];s.x-=i,s.y-=r}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getBoundingClientRect(e){let i,r,o,s,a,l,c=1/0,d=-1/0,u=1/0,f=-1/0;if(this._update(!0),i=e?this.matrix:this.worldMatrix,r=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:h,scaleY:p}=ki(i.elements[0],i.elements[3],i.elements[1],i.elements[4],i.elements[2],i.elements[5]);typeof h=="number"&&typeof p=="number"&&(r=Math.max(h,p)*(this.linewidth||0)/2)}else r*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(s=0;s<o;s++){l=this._renderer.vertices[s],a=this._renderer.vertices[(s+o-1)%o];const[h,p]=i.multiply(a.x,a.y),[m,g]=i.multiply(l.x,l.y);if(a.controls&&l.controls){let b=a.controls.right.x,y=a.controls.right.y;a.relative&&(b+=a.x,y+=a.y);let[_,k]=i.multiply(b,y),x=l.controls.left.x,v=l.controls.left.y;l.relative&&(x+=l.x,v+=l.y);let[B,w]=i.multiply(x,v);const T=Cc(h,p,_,k,B,w,m,g);u=ir(T.min.y-r,u),c=ir(T.min.x-r,c),d=rr(T.max.x+r,d),f=rr(T.max.y+r,f)}else s<=1&&(u=ir(p-r,u),c=ir(h-r,c),d=rr(h+r,d),f=rr(p+r,f)),u=ir(g-r,u),c=ir(m-r,c),d=rr(m+r,d),f=rr(g+r,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&this.visible===!1||!s&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();if(!l||e<l.left-a||e>l.right+a||i<l.top-a||i>l.bottom+a)return!1;const c=this.worldMatrix,d=c&&c.inverse(s0);if(!d)return super.contains(e,i,o);const[u,f]=d.multiply(e,i,1),h=typeof o.precision=="number"&&!Number.isNaN(o.precision)?Math.max(1,Math.floor(o.precision)):8,p=Yy(this,o.fill),m=Uy(this,o.stroke),{polygons:g,segments:b}=Wy(this,h);if(p&&g.length>0&&jy(g,u,f))return!0;if(m&&b.length>0){const y=typeof this.linewidth=="number"?this.linewidth:0;if(y>0&&Xy(b,u,f)<=y/2+a)return!0}return!p&&!m?super.contains(e,i,o):p&&g.length===0?super.contains(e,i,o):!1}getPointAt(e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_=this.length*Math.min(Math.max(e,0),1);const k=this.vertices.length,x=k-1;let v=null,B=null;for(let G=0,W=this._lengths.length,D=0;G<W;G++){if(D+this._lengths[G]>=_){this._closed?(r=st(G,k),o=st(G-1,k),G===0&&(r=o,o=G)):(r=G,o=Math.min(Math.max(G-1,0),x)),v=this.vertices[r],B=this.vertices[o],_-=D,this._lengths[G]!==0?e=_/this._lengths[G]:e=0;break}D+=this._lengths[G]}if(v===null||B===null)return null;if(v){if(!B)return v}else return B;y=B.controls&&B.controls.right,b=v.controls&&v.controls.left,l=B.x,h=B.y,c=(y||B).x,p=(y||B).y,d=(b||v).x,m=(b||v).y,u=v.x,g=v.y,y&&B.relative&&(c+=B.x,p+=B.y),b&&v.relative&&(d+=v.x,m+=v.y),a=Rr(e,l,c,d,u),f=Rr(e,h,p,m,g);const w=Vt(l,c,e),T=Vt(h,p,e),C=Vt(c,d,e),$=Vt(p,m,e),E=Vt(d,u,e),I=Vt(m,g,e),R=Vt(w,C,e),O=Vt(T,$,e),U=Vt(C,E,e),Q=Vt($,I,e);return oe.isObject(i)?(i.x=a,i.y=f,i instanceof Ee&&(i.controls.left.x=R,i.controls.left.y=O,i.controls.right.x=U,i.controls.right.y=Q,(typeof i.relative!="boolean"||i.relative)&&(i.controls.left.x-=a,i.controls.left.y-=f,i.controls.right.x-=a,i.controls.right.y-=f)),i.t=e,i):(s=new Ee(a,f,R-a,O-f,U-a,Q-f,this._curved?ne.curve:ne.line),s.t=e,s)}plot(){if(this.curved)return Sc(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ne.move:ne.line;return this}smooth(e){const i=e||{},r=i.type||"continuous",o=this._collection,s=o.length;if(s<2)return this;const a=this._closed||s>0&&o[s-1]&&o[s-1].command===ne.close,l=(h,p)=>{if(h==null)return p;if(typeof h=="number"){if(a)return st(h,s);let g=h;return g<0&&(g+=s),Math.min(Math.max(g,0),s-1)}const m=o.indexOf(h);return m!==-1?m:p},c=a&&i.from===void 0&&i.to===void 0;let d=l(i.from,0),u=l(i.to,s-1);if(d>u)if(a)d-=s;else{const h=d;d=u,u=h}const f=u-d+1;for(let h=0;h<f;h+=1){const p=st(d+h,s),m=o[p],g=!a&&p===0;m.command===ne.move&&!g&&(m.command=ne.line)}if(r==="continuous"||r==="asymmetric")Jy(o,d,u,a,c,r==="asymmetric");else if(r==="catmull-rom"||r==="geometric"){const h={type:r,factor:i.factor};n0(o,d,u,a,c,h)}else throw new Error(`Path.smooth does not support type "${r}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(e){this._update();const i=this.vertices,r=i.length;if(r<2)return this;const o=[];let s=null,a=null;for(let l=0;l<r;l+=1){const c=i[l];if(!s||c.command===ne.move){const u=c.clone();o.push(u),s=c,a=c;continue}if(Zy(c,s)){const f=js(c,s,e).length,h=o[o.length-1];let p=h.clone(),m=c.clone(),g=h,b=0;if(f<=1){const y=c.clone();o.push(y)}else{for(let _=1;_<f;_+=1){const k=_/f,x=1-b,v=x<=Number.EPSILON?k:(k-b)/x,B=Qy(p,m,v);pn(g,"right",B.startOut.x-g.x,B.startOut.y-g.y);const w=B.anchor;o.push(w),g=w,p=w.clone(),b=k,pn(m,"left",B.endIn.x-m.x,B.endIn.y-m.y)}const y=c.clone();y.controls.left.copy(m.controls.left),o.push(y)}}else{const u=js(c,s,e);for(let h=1;h<u.length;h+=1){const p=u[h];jc(p,s),Wt(p,"left"),Wt(p,"right"),p.command=ne.line,o.push(p)}const f=c.clone();o.push(f)}s=c,c.command===ne.close&&(s=a)}return this._automatic=!1,this._curved=!1,this.vertices=o,this}_updateLength(e,i){i||this._update();const o=this.vertices.length-1;let s=this.vertices[o],a=0;return typeof this._lengths>"u"&&(this._lengths=[]),oe.each(this.vertices,function(l,c){if(c<=0||l.command===ne.move){s=l,this._lengths[c]=0;return}this._lengths[c]=Ac(l,s,e),a+=this._lengths[c],s=l},this),this._length=a,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,i=this._closed,r=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),s=po(this,r*this._length),a=po(this,o*this._length),l=i0(s),c=r0(a);let d,u,f,h,p,m;for(this._renderer.vertices.length=0,m=0;m<e;m++)this._renderer.collection.length<=m&&this._renderer.collection.push(new Ee),m>c&&!u?(p=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(o,p),p.command=this._renderer.collection[m].command,this._renderer.vertices.push(p),u=p,f=this._collection[m-1],f&&f.controls&&(p.relative?p.controls.right.clear():p.controls.right.copy(p),f.relative?this._renderer.collection[m-1].controls.right.copy(f.controls.right).lerp(re.zero,1-p.t):this._renderer.collection[m-1].controls.right.copy(f.controls.right).lerp(f,1-p.t))):m>=l&&m<=c&&(p=this._renderer.collection[m].copy(this._collection[m]),this._renderer.vertices.push(p),m===c&&Ic(this,o)?(u=p,!i&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):m===l&&Ic(this,r)&&(d=p,d.command=ne.move,!i&&d.controls&&(d.relative?d.controls.left.clear():d.controls.left.copy(d))));l>0&&!d&&(m=l-1,p=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(r,p),p.command=ne.move,this._renderer.vertices.unshift(p),h=this._collection[m+1],h&&h.controls&&(p.controls.left.clear(),h.relative?this._renderer.collection[m+1].controls.left.copy(h.controls.left).lerp(re.zero,p.t):(o0.copy(h),this._renderer.collection[m+1].controls.left.copy(h.controls.left).lerp(h,p.t))))}return Hn.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,Hn.prototype.flagReset.call(this),this}};S(Ys,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),S(Ys,"Utils",{getCurveLength:Ac});var Pe=Ys,Xc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=!!n,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=!!n,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){if(n===this._automatic)return;this._automatic=!!n;const e=this._automatic?"ignore":"listen";oe.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),n instanceof li?this._collection=n:this._collection=new li(n||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,oe.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function Yc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Uc(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Kc(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Gc(){this._flagFill=!0}function Zc(){this._flagStroke=!0}var Qc=class no extends Pe{constructor(e,i,r,o){const s=[new Ee,new Ee,new Ee,new Ee];super(s,!0,!1,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_origin",null),this._renderer.type="rectangle";for(let a in Jc)Object.defineProperty(this,a,Jc[a]);this.width=typeof r=="number"?r:1,this.height=typeof o=="number"?o:1,this.origin=new re,typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i),this._update()}static fromObject(e){const i=new no().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<no.Properties.length;i++){const r=no.Properties[i];r in e&&(typeof e[r]=="number"?this[r]=e[r]:this[r]instanceof re&&this[r].copy(e[r]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,i=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ee),this.vertices[0].set(-e,-i).sub(this._origin).command=ne.move,this.vertices[1].set(e,-i).sub(this._origin).command=ne.line,this.vertices[2].set(e,i).sub(this._origin).command=ne.line,this.vertices[3].set(-e,i).sub(this._origin).command=ne.line,this.vertices[4]&&(this.vertices[4].set(-e,-i).sub(this._origin).command=ne.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=new no(0,0,this.width,this.height);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]instanceof re?i[o].copy(this[o]):i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="rectangle",e.width=this.width,e.height=this.height,e.origin=this.origin.toObject(),e}};S(Qc,"Properties",["width","height","origin"]);var di=Qc,Jc={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(n){this._origin&&this._origin.unbind(ee.Types.change,this._renderer.flagVertices),this._origin=n,this._origin.bind(ee.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},ed=class io extends di{constructor(e,i,r,o,s,a){super(i,r,0,0),S(this,"_flagTexture",!1),S(this,"_flagColumns",!1),S(this,"_flagRows",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_texture",null),S(this,"_columns",1),S(this,"_rows",1),S(this,"_frameRate",0),S(this,"_index",0),S(this,"_origin",null),this._renderer.type="sprite";for(let l in td)Object.defineProperty(this,l,td[l]);this.noStroke(),this.noFill(),e instanceof ze?this.texture=e:typeof e=="string"&&(this.texture=new ze(e)),this.origin=new re,this._update(),typeof o=="number"&&(this.columns=o),typeof s=="number"&&(this.rows=s),typeof a=="number"&&(this.frameRate=a),this.index=0}static fromObject(e){const i=new io().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<io.Properties.length;i++){const r=io.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(e){const i=new io(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&i.play(this._firstFrame,this._lastFrame),i.loop=this.loop,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="sprite",e.texture=this.texture.toObject(),e.columns=this.columns,e.rows=this.rows,e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture,i=this._columns,r=this._rows;let o,s,a,l,c,d,u,f,h;if(e&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=e),e.loaded)){u=e.image.width,f=e.image.height,o=u/i,s=f/r,l=this._amount,this.width!==o&&(this.width=o),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(oe.isNaN(this._lastFrame)&&(this._lastFrame=l-1),a=oe.performance.now()-this._startTime,h=this._lastFrame+1,c=1e3*(h-this._firstFrame)/this._frameRate,this._loop?a=a%c:a=Math.min(a,c),d=Vt(this._firstFrame,h,a/c),d=Math.floor(d),d!==this._index&&(this._index=d,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const p=this._index%i,m=Math.floor(this._index/i),g=-o*p+(u-o)/2,b=-s*m+(f-s)/2;g!==e.offset.x&&(e.offset.x=g),b!==e.offset.y&&(e.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(ed,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var xo=ed,td={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(n){this._columns=n,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(n){this._rows=n,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}},Us,nd=class extends li{constructor(e){e=Array.isArray(e)?e:Array.prototype.slice.call(arguments),super(e),mc(this,Us,{}),this.attach(e),this.on(ee.Types.insert,this.attach),this.on(ee.Types.remove,this.detach)}get ids(){return Lt(this,Us)}attach(e){for(let i=0;i<e.length;i++){const r=e[i];r&&r.id&&(this.ids[r.id]=r)}return this}detach(e){for(let i=0;i<e.length;i++)delete this.ids[e[i].id];return this}};Us=new WeakMap;var id=class Xi extends Pe{constructor(e,i,r,o,s,a,l){const c=l||Ct.Resolution*3,d=[];for(let u=0;u<c;u++)d.push(new Ee);super(d,!0,!1,!0),S(this,"_flagStartAngle",!1),S(this,"_flagEndAngle",!1),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_startAngle",0),S(this,"_endAngle",tt),S(this,"_innerRadius",0),S(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let u in rd)Object.defineProperty(this,u,rd[u]);typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.startAngle=s),typeof a=="number"&&(this.endAngle=a),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Xi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Xi.Properties.length;i++){const r=Xi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,i=this._endAngle,r=this._innerRadius,o=this._outerRadius,s=st(e,tt)===st(i,tt),a=r>0,l=this.vertices;let c=a?l.length/2:l.length,d,u=0,f,h,p,m,g,b,y,_,k;for(s?c--:a||(c-=2),f=0,h=c-1;f<c;f++){switch(p=f/h,m=l[u],g=p*(i-e)+e,b=(i-e)/c,y=o*Math.cos(g),_=o*Math.sin(g),f){case 0:d=ne.move;break;default:d=ne.curve}m.command=d,m.x=y,m.y=_,m.controls.left.clear(),m.controls.right.clear(),m.command===ne.curve&&(k=o*b/Math.PI,m.controls.left.x=k*Math.cos(g-dt),m.controls.left.y=k*Math.sin(g-dt),m.controls.right.x=k*Math.cos(g+dt),m.controls.right.y=k*Math.sin(g+dt),f===1&&m.controls.left.multiplyScalar(2),f===h&&m.controls.right.multiplyScalar(2)),u++}if(a){for(s?(l[u].command=ne.close,u++):(c--,h=c-1),f=0;f<c;f++)p=f/h,m=l[u],g=(1-p)*(i-e)+e,b=(i-e)/c,y=r*Math.cos(g),_=r*Math.sin(g),d=ne.curve,f<=0&&(d=s?ne.move:ne.line),m.command=d,m.x=y,m.y=_,m.controls.left.clear(),m.controls.right.clear(),m.command===ne.curve&&(k=r*b/Math.PI,m.controls.left.x=k*Math.cos(g+dt),m.controls.left.y=k*Math.sin(g+dt),m.controls.right.x=k*Math.cos(g-dt),m.controls.right.y=k*Math.sin(g-dt),f===1&&m.controls.left.multiplyScalar(2),f===h&&m.controls.right.multiplyScalar(2)),u++;l[u].copy(l[0]),l[u].command=ne.line}else s||(l[u].command=ne.line,l[u].x=0,l[u].y=0,u++,l[u].copy(l[0]),l[u].command=ne.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.startAngle,s=this.endAngle,a=this.vertices.length,l=new Xi(0,0,i,r,o,s,a);l.translation.copy(this.translation),l.rotation=this.rotation,l.scale=this.scale,l.skewX=this.skewX,l.skewY=this.skewY,this.matrix.manual&&l.matrix.copy(this.matrix);for(let c=0;c<Pe.Properties.length;c++){const d=Pe.Properties[c];l[d]=this[d]}return e&&e.add(l),l}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let i=0;i<Xi.Properties.length;i++){const r=Xi.Properties[i];e[r]=this[r]}return e}};S(id,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var Ks=id,rd={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(n){this._startAngle=n,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(n){this._endAngle=n,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}}},Gs=Math.cos,Zs=Math.sin,od=class Yi extends Pe{constructor(e,i,r,o){const s=o?Math.max(o,2):4,a=[];for(let l=0;l<s;l++)a.push(new Ee(0,0,0,0,0,0));super(a,!0,!0,!0),S(this,"_flagRadius",!1),S(this,"_radius",0),this._renderer.type="circle";for(let l in sd)Object.defineProperty(this,l,sd[l]);typeof r=="number"&&(this.radius=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Yi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Yi.Properties.length;i++){const r=Yi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(e*2)),r=this._radius,o=r*i;for(let s=0;s<this.vertices.length;s++){const l=s/e*tt,c=r*Gs(l),d=r*Zs(l),u=o*Gs(l-dt),f=o*Zs(l-dt),h=o*Gs(l+dt),p=o*Zs(l+dt),m=this.vertices[s];m.command=s===0?ne.move:ne.curve,m.set(c,d),m.controls.left.set(u,f),m.controls.right.set(h,p)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=new Yi(0,0,this.radius,this.vertices.length);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let i=0;i<Yi.Properties.length;i++){const r=Yi.Properties[i];e[r]=this[r]}return e}};S(od,"Properties",["radius"]);var ko=od,sd={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},Qs=Math.cos,Js=Math.sin,ad=class Ui extends Pe{constructor(e,i,r,o,s){typeof o!="number"&&typeof r=="number"&&(o=r);const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ee);super(l,!0,!0,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),this._renderer.type="ellipse";for(let c in ld)Object.defineProperty(this,c,ld[c]);typeof r=="number"&&(this.width=r*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Ui().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Ui.Properties.length;i++){const r=Ui.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(this.vertices.length*2)),r=this._width/2,o=this._height/2;for(let s=0;s<this.vertices.length;s++){const l=s/e*tt,c=r*Qs(l),d=o*Js(l),u=r*i*Qs(l-dt),f=o*i*Js(l-dt),h=r*i*Qs(l+dt),p=o*i*Js(l+dt),m=this.vertices[s];m.command=s===0?ne.move:ne.curve,m.set(c,d),m.controls.left.set(u,f),m.controls.right.set(h,p)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=this.width/2,r=this.height/2,o=this.vertices.length,s=new Ui(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let i=0;i<Ui.Properties.length;i++){const r=Ui.Properties[i];e[r]=this[r]}return e}};S(ad,"Properties",["width","height"]);var Co=ad,ld={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}}},a0=Math.ceil,l0=Math.floor,cd=class _i extends Hn{constructor(e){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagSize",!0),S(this,"_flagSizeAttenuation",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_size",1),S(this,"_sizeAttenuation",!1),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0),S(this,"noFill",Pe.prototype.noFill),S(this,"noStroke",Pe.prototype.noStroke),S(this,"corner",Pe.prototype.corner),S(this,"center",Pe.prototype.center),S(this,"getBoundingClientRect",Pe.prototype.getBoundingClientRect),S(this,"_updateLength",Pe.prototype._updateLength);for(let i in dd)Object.defineProperty(this,i,dd[i]);this._renderer.type="points",this._renderer.flagVertices=Yc.bind(this),this._renderer.bindVertices=Uc.bind(this),this._renderer.unbindVertices=Kc.bind(this),this._renderer.flagFill=Gc.bind(this),this._renderer.flagStroke=Zc.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=e,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Ci(e.fill),r=typeof e.stroke=="string"?e.stroke:Ci(e.stroke),o=new _i().copy(Vs(Er({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof Ee?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new Ee().copy(r))}for(let i=0;i<_i.Properties.length;i++){const r=_i.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new _i;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<_i.Properties.length;r++){const o=_i.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(i=>i.toObject()),oe.each(_i.Properties,function(i){typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(e){this._update();let i=[];for(let r=0;r<this.vertices.length;r++){const o=this.vertices[r],s=this.vertices[r-1];if(!s)continue;const a=o.x,l=o.y,c=s.x,d=s.y,u=As(a,l,a,l,c,d,c,d,e);i=i.concat(u)}return this.vertices=i,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),i=Math.max(this._beginning,this._ending),r=po(this,e*this._length),o=po(this,i*this._length),s=a0(r),a=l0(o);let l=0,c;this._renderer.vertices=[],this._renderer.collection=[];for(let d=0;d<this._collection.length;d++)d>=s&&d<=a&&(c=this._collection[d],this._renderer.collection.push(c),this._renderer.vertices[l*2+0]=c.x,this._renderer.vertices[l*2+1]=c.y,l++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};S(cd,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);var ea=cd,dd={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(n){this._sizeAttenuation=n,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),n instanceof li?this._collection=n:this._collection=new li(n||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}},c0=Math.cos,d0=Math.sin,ud=class Ki extends Pe{constructor(e,i,r,o){o=Math.max(o||0,3),super(),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagSides",!1),S(this,"_radius",0),S(this,"_width",0),S(this,"_height",0),S(this,"_sides",0),this._renderer.type="polygon";for(let s in fd)Object.defineProperty(this,s,fd[s]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.radius=r),typeof o=="number"&&(this.sides=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Ki().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Ki.Properties.length;i++){const r=Ki.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,a=tt*s+Math.PI/2,l=this._width*c0(a)/2,c=this._height*d0(a)/2;o>=r?this.vertices.push(new Ee(l,c)):this.vertices[o].set(l,c),this.vertices[o].command=o===0?ne.move:ne.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=new Ki(0,0,0,this.sides);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.width=this.width,i.height=this.height,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let i=0;i<Ki.Properties.length;i++){const r=Ki.Properties[i];e[r]=this[r]}return e}};S(ud,"Properties",["width","height","sides"]);var ta=ud,fd={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this.width=n*2,this.height=n*2}},width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},hd=class Gi extends Pe{constructor(e,i,r,o,s){typeof s>"u"&&typeof r=="number"&&typeof o=="number"&&(s=Math.floor(Math.min(r,o)/12));const a=[];for(let l=0;l<10;l++)a.push(new Ee(0,0,0,0,0,0,l===0?ne.move:ne.curve));super(a),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagRadius",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let l in md)Object.defineProperty(this,l,md[l]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=u0.bind(this),typeof r=="number"&&(this.width=r),typeof o=="number"&&(this.height=o),(typeof s=="number"||s instanceof re)&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Gi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Gi.Properties.length;i++){const r=Gi.Properties[i];if(r in e){const o=e[r];/radius/i.test(r)?this[r]=typeof o=="number"||o instanceof re?o:new re().copy(o):typeof o=="number"&&(this[r]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,i=this._height;let r,o;this._radius instanceof re?(r=this._radius.x,o=this._radius.y):(r=this._radius,o=this._radius);let s,a=e/2,l=i/2;s=this.vertices[0],s.x=-(a-r),s.y=-l,s=this.vertices[1],s.x=a-r,s.y=-l,s.controls.left.clear(),s.controls.right.x=r,s.controls.right.y=0,s=this.vertices[2],s.x=a,s.y=-(l-o),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=a,s.y=l-o,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=o,s=this.vertices[4],s.x=a-r,s.y=l,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(a-r),s.y=l,s.controls.left.clear(),s.controls.right.x=-r,s.controls.right.y=0,s=this.vertices[6],s.x=-a,s.y=l-o,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-a,s.y=-(l-o),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-o,s=this.vertices[8],s.x=-(a-r),s.y=-l,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[9],s.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=this.width,r=this.height,o=this.radius,s=new Gi(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let i=0;i<Gi.Properties.length;i++){const r=Gi.Properties[i];e[r]=this[r]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}};S(hd,"Properties",["width","height","radius"]);var vo=hd,md={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius instanceof re&&this._radius.unbind(ee.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof re&&this._radius.bind(ee.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function u0(){this._flagRadius=!0}var f0=Math.cos,h0=Math.sin,pd=class Zi extends Pe{constructor(e,i,r,o,s){arguments.length<=3&&(o=r,r=o/2),(typeof s!="number"||s<=0)&&(s=5),super(),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_flagSides",!1),S(this,"_innerRadius",0),S(this,"_outerRadius",0),S(this,"_sides",0),this._renderer.type="star";for(let a in gd)Object.defineProperty(this,a,gd[a]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Zi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Zi.Properties.length;i++){const r=Zi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,a=tt*s,l=(o%2?this._outerRadius:this._innerRadius)/2,c=l*f0(a),d=l*h0(a);o>=r?this.vertices.push(new Ee(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?ne.move:ne.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.sides,s=new Zi(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let i=0;i<Zi.Properties.length;i++){const r=Zi.Properties[i];e[r]=this[r]}return e}};S(pd,"Properties",["innerRadius","outerRadius","sides"]);var na=pd,gd={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},ia,yd=Math.min,bd=Math.max;Ke.document&&(ia=document.createElement("canvas"));var ra=class rn extends Hn{constructor(e,i,r,o){super(),S(this,"_flagValue",!0),S(this,"_flagFamily",!0),S(this,"_flagSize",!0),S(this,"_flagLeading",!0),S(this,"_flagAlignment",!0),S(this,"_flagBaseline",!0),S(this,"_flagStyle",!0),S(this,"_flagWeight",!0),S(this,"_flagDecoration",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_flagDirection",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_value",""),S(this,"_family","sans-serif"),S(this,"_size",13),S(this,"_leading",17),S(this,"_alignment","center"),S(this,"_baseline","middle"),S(this,"_style","normal"),S(this,"_weight",500),S(this,"_decoration","none"),S(this,"_direction","ltr"),S(this,"_fill","#000"),S(this,"_stroke","none"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in _d)Object.defineProperty(this,s,_d[s]);if(this._renderer.type="text",this._renderer.flagFill=m0.bind(this),this._renderer.flagStroke=p0.bind(this),this.value=e,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this.dashes=[],this.dashes.offset=0,!oe.isObject(o))return this;for(let s=0;s<rn.Properties.length;s++){const a=rn.Properties[s];a in o&&(this[a]=o[a])}}static Measure(e){if(ia){const i=ia.getContext("2d");i.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const r=i.measureText(e.value,0,0),o=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent;return{width:r.width,height:o}}else{const i=this.value.length*this.size*rn.Ratio,r=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:i,height:r}}}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Ci(e.fill),r=typeof e.stroke=="string"?e.stroke:Ci(e.stroke),o=new rn().copy(Vs(Er({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<rn.Properties.length;i++){const r=rn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new rn(this.value);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale;for(let r=0;r<rn.Properties.length;r++){const o=rn.Properties[r];i[o]=this[o]}return this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let i=0;i<rn.Properties.length;i++){const r=rn.Properties[i];e[r]=this[r]}return e}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let i,r,o,s,a;this._update(!0),i=e?this.matrix:this.worldMatrix;const{width:l,height:c}=rn.Measure(this),d=(this._linewidth||0)/2;switch(this.alignment){case"left":r=-d,o=l+d;break;case"right":r=-(l+d),o=d;break;default:r=-(l/2+d),o=l/2+d}switch(this.baseline){case"middle":s=-(c/2+d),a=c/2+d;break;default:s=-(c+d),a=d}const[u,f]=i.multiply(r,s),[h,p]=i.multiply(r,a),[m,g]=i.multiply(o,s),[b,y]=i.multiply(o,a);return s=yd(f,p,g,y),r=yd(u,h,m,b),o=bd(u,h,m,b),a=bd(f,p,g,y),{top:s,left:r,right:o,bottom:a,width:o-r,height:a-s}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};S(ra,"Ratio",.6),S(ra,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);var Sn=ra,_d={value:{enumerable:!0,get:function(){return this._value},set:function(n){this._value=n,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(n){this._family=n,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(n){this._leading=n,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(n){this._alignment=n,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(n){this._style=n,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(n){this._weight=n,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(n){this._decoration=n,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(n){this._direction=n,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(n){this._baseline=n,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,oe.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function m0(){this._flagFill=!0}function p0(){this._flagStroke=!0}var oa=class wr extends di{constructor(e,i,r,o){super(i,r,0,0),S(this,"_flagTextures",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_index",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_textures",null),S(this,"_frameRate",0),S(this,"_origin",null),this._renderer.type="image-sequence";for(let s in wd)Object.defineProperty(this,s,wd[s]);this._renderer.flagTextures=g0.bind(this),this._renderer.bindTextures=y0.bind(this),this._renderer.unbindTextures=b0.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(xd.bind(this)):typeof e=="string"&&(this.textures=[xd(e)]),this.origin=new re,this._update(),typeof o=="number"?this.frameRate=o:this.frameRate=wr.DefaultFrameRate,this.index=0}static fromObject(e){const i=new wr().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<wr.Properties.length;i++){const r=wr.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(e){const i=new wr(this.textures,this.translation.x,this.translation.y,this.frameRate);return i._loop=this._loop,this._playing&&i.play(),e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image-sequence",e.textures=this.textures.map(function(i){return i.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let e=0;e<this.textures.length;e++){const i=this.textures[e];typeof i.dispose=="function"?i.dispose():typeof i.unbind=="function"&&i.unbind()}return this}_update(){const e=this._textures;let i,r,o,s,a,l,c,d;return e&&(this._flagTextures&&(this._amount=e.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(s=this._amount,oe.isNaN(this._lastFrame)&&(this._lastFrame=s-1),o=oe.performance.now()-this._startTime,d=this._lastFrame+1,a=1e3*(d-this._firstFrame)/this._frameRate,this._loop?o=o%a:o=Math.min(o,a),c=Vt(this._firstFrame,d,o/a),c=Math.floor(c),c!==this._index&&(this._index=c,l=e[this._index],l.loaded&&(i=l.image.width,r=l.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r),this.fill=l,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof ze))&&(l=e[this._index],l.loaded&&(i=l.image.width,r=l.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r)),this.fill=l)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(oa,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),S(oa,"DefaultFrameRate",30);var sa=oa,wd={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(n){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._textures=new li((n||[]).slice(0)),this._textures.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}};function g0(){this._flagTextures=!0}function y0(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function b0(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function xd(n){if(n instanceof ze)return n;if(typeof n=="string")return new ze(n)}var So=Math.min,Bo=Math.max,_0={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},aa=class un extends Hn{constructor(e){super(),S(this,"_flagAdditions",!1),S(this,"_flagSubtractions",!1),S(this,"_flagOrder",!1),S(this,"_flagOpacity",!0),S(this,"_flagBeginning",!1),S(this,"_flagEnding",!1),S(this,"_flagLength",!1),S(this,"_flagMask",!1),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_length",0),S(this,"_mask",null),S(this,"_strokeAttenuation",!0);for(let i in kd)Object.defineProperty(this,i,kd[i]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let i=0;i<e.length;i++)Cd.call(this,e[i],this)}static RemoveChildren(e){for(let i=0;i<e.length;i++)Cd.call(this,e[i])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const i=new un;for(let o=0;o<un.Properties.length;o++){const s=un.Properties[o];s in e&&(/(fill|stroke)/i.test(s)?i[s]=typeof e[s]=="string"?e[s]:Ci(e[s]):i[s]=e[s])}return"mask"in e&&(i.mask=r(e.mask)),"id"in e&&(i.id=e.id),i.children=e.children.map(r),i;function r(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return Ks.fromObject(o);case"circle":return ko.fromObject(o);case"element":return er.fromObject(o);case"ellipse":return Co.fromObject(o);case"group":return un.fromObject(o);case"image":return Image.fromObject(o);case"image-sequence":return sa.fromObject(o);case"path":return Pe.fromObject(o);case"points":return ea.fromObject(o);case"polygon":return ta.fromObject(o);case"rectangle":return di.fromObject(o);case"rounded-rectangle":return vo.fromObject(o);case"shape":return Hn.fromObject(o);case"sprite":return xo.fromObject(o);case"star":return na.fromObject(o);case"text":return Sn.fromObject(o)}return o}}static IsVisible(e,i){if(!i)return!0;let r=e;for(;r;){if(typeof r.visible=="boolean"&&!r.visible||typeof r.opacity=="number"&&r.opacity<=0)return!1;r=r.parent}return!0}static VisitForHitTest(e,i,r,o,s,a,l){const c=e&&e.children;if(!c)return!1;const d=i.results;for(let u=c.length-1;u>=0;u--){const f=c[u];if(!f||!un.IsVisible(f,i.visibleOnly))continue;const h=typeof f.getBoundingClientRect=="function"?f.getBoundingClientRect():null;if(!(h&&!Ky(h,i.x,i.y,a))){if(f instanceof un){if(r&&(!o||o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),l)||un.VisitForHitTest(f,i,r,o,s,a,l))return!0;continue}if(f instanceof Hn&&!(o&&!o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),l))return!0}}return!1}copy(e){super.copy.call(this,e),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let i=0;i<un.Properties.length;i++){const r=un.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new un,r=this.children.map(function(o){return o.clone()});return i.add(r),i.opacity=this.opacity,this.mask&&(i.mask=this.mask),i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.className=this.className,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="group",e.children=[],e.opacity=this.opacity,e.className=this.className,e.mask=this.mask?this.mask.toObject():null,oe.each(this.children,(i,r)=>{e.children[r]=i.toObject()},this),e}dispose(){if(super.dispose(),this.children)for(let e=0;e<this.children.length;e++){const i=this.children[e];typeof i.dispose=="function"&&i.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(e,i,r){const o=r||{},{results:s,hitOptions:a,context:l,single:c,empty:d}=_0.getShapesAtPoint;s.length=0;const u=o.mode==="deepest"||o.deepest?"deepest":"all",f=o.visibleOnly!==!1,h=!!o.includeGroups,p=typeof o.filter=="function"?o.filter:null,m=typeof o.tolerance=="number"?o.tolerance:0;typeof o.precision=="number"?a.precision=o.precision:delete a.precision,typeof o.fill<"u"?a.fill=o.fill:delete a.fill,typeof o.stroke<"u"?a.stroke=o.stroke:delete a.stroke,a.tolerance=m,a.ignoreVisibility=!f;const g=u==="deepest";if(l.x=e,l.y=i,l.visibleOnly=f,l.results=s,un.VisitForHitTest(this,l,h,p,a,m,g),g){if(s.length>0){const y=s[0];return s.length=0,c[0]=y,c.length=1,c}return d.length=0,d}const b=s.slice();return s.length=0,b}corner(){const e=this.getBoundingClientRect(!0);for(let i=0;i<this.children.length;i++){const r=this.children[i];r.translation.x-=e.left,r.translation.y-=e.top}return this.mask&&(this.mask.translation.x-=e.left,this.mask.translation.y-=e.top),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const s=this.children[o];s.isShape&&(s.translation.x-=i,s.translation.y-=r)}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getById(e){let i=null;function r(o){if(o.id===e)return o;if(o.children){if(o.children.ids[e])return o.children.ids[e];for(let s=0;s<o.children.length;s++)if(i=r(o.children[s]),i)return i}return null}return r(this)}getByClassName(e){const i=[];function r(o){if(Array.prototype.indexOf.call(o.classList,e)>=0&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return i}return r(this)}getByType(e){const i=[];function r(o){if(o instanceof e&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return i}return r(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let i=0;i<e.length;i++){const r=e[i];if(!(r&&r.id))continue;const o=Array.prototype.indexOf.call(this.children,r);o>=0&&this.children.splice(o,1),this.children.push(r)}return this}remove(e){const i=arguments.length,r=this.parent;if(i<=0&&r)return r.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let o=0;o<e.length;o++){const s=e[o];if(!s||!this.children.ids[s.id])continue;const a=this.children.indexOf(s);a>=0&&this.children.splice(a,1)}return this}getBoundingClientRect(e){let i,r,o,s,a,l;this._update(!0);let c=1/0,d=-1/0,u=1/0,f=-1/0;const h=/texture|gradient/i;r=e?this.matrix:this.worldMatrix;for(let p=0;p<this.children.length;p++){const m=this.children[p];if(!(!m.visible||h.test(m._renderer.type))&&(i=m.getBoundingClientRect(e),o=typeof i.top!="number"||oe.isNaN(i.top)||!isFinite(i.top),s=typeof i.left!="number"||oe.isNaN(i.left)||!isFinite(i.left),a=typeof i.right!="number"||oe.isNaN(i.right)||!isFinite(i.right),l=typeof i.bottom!="number"||oe.isNaN(i.bottom)||!isFinite(i.bottom),!(o||s||a||l)))if(e){const[g,b]=r.multiply(i.left,i.top),[y,_]=r.multiply(i.right,i.top),[k,x]=r.multiply(i.left,i.bottom),[v,B]=r.multiply(i.right,i.bottom);u=So(b,_,x,B,u),c=So(g,y,k,v,c),d=Bo(g,y,k,v,d),f=Bo(b,_,x,B,f)}else u=So(i.top,u),c=So(i.left,c),d=Bo(i.right,d),f=Bo(i.bottom,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}noFill(){return this.children.forEach(function(e){e.noFill()}),this}noStroke(){return this.children.forEach(function(e){e.noStroke()}),this}subdivide(){const e=arguments;return this.children.forEach(function(i){i.subdivide.apply(i,e)}),this}_update(){let e,i,r;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=this.length;let l=0;const c=o*a,d=s*a;for(e=0;e<this.children.length;e++)r=this.children[e],i=r.length,c>l+i?(r.beginning=1,r.ending=1):d<l?(r.beginning=0,r.ending=0):c>l&&c<l+i?(r.beginning=(c-l)/i,r.ending=1):d>l&&d<l+i?(r.beginning=0,r.ending=(d-l)/i):(r.beginning=0,r.ending=1),l+=i}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};S(aa,"Children",nd),S(aa,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var gt=aa,kd={visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._flagVisible=this._visible!==n||this._flagVisible,this._visible=n}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._flagOpacity=this._opacity!==n||this._flagOpacity,this._opacity=n}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._flagBeginning=this._beginning!==n||this._flagBeginning,this._beginning=n}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._flagEnding=this._ending!==n||this._flagEnding,this._ending=n}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let n=0;n<this.children.length;n++){const e=this.children[n];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){this._fill=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=n}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){this._stroke=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=n}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=n}}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=n}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=n}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=n}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=n}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=n}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){this._automatic=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=n}}},children:{enumerable:!0,get:function(){return this._children},set:function(n){const e=gt.InsertChildren.bind(this),i=gt.RemoveChildren.bind(this),r=gt.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new nd(n),this._children.bind(ee.Types.insert,e),this._children.bind(ee.Types.remove,i),this._children.bind(ee.Types.order,r),n.length>0&&e(n)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,oe.isObject(n)&&!n.clip&&(n.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=n)}}}};function Cd(n,e){const i=n.parent;let r;if(i===e){o();return}if(i&&i.children.ids[n.id]&&(r=Array.prototype.indexOf.call(i.children,n),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete n.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,n),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,n),r>=0&&e.additions.splice(r,1)),n.parent=e,e.additions.push(n),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,n),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,n),r<0&&(i.subtractions.push(n),i._flagSubtractions=!0)}}var No=class extends Pe{constructor(e,i,r,o){const s=[new Ee(e,i),new Ee(r,o)];super(s);for(let a in vd)Object.defineProperty(this,a,vd[a]);this.vertices[0].command=ne.move,this.vertices[1].command=ne.line,this.automatic=!1}};S(No,"Properties",["left","right"]);var vd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(oe.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=ne.move;else{const e=new Ht("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(n){if(oe.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=ne.line;else{const e=new Ht("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}},Bn={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},w0={start:"left",middle:"center",end:"right"},Sd=["id","class","transform","xmlns","viewBox"],x0=["x","y","width","height","href","xlink:href"];function k0(n){return w0[n]}function C0(n){const e=n.getAttribute("dominant-baseline"),i=n.getAttribute("alignment-baseline");return e||i}function Pr(n){return n.replace(/svg:/gi,"").toLowerCase()}function Bd(n,e){if(e.x+=n.translateX,e.y+=n.translateY,e.x*=n.scaleX,e.y*=n.scaleY,n.rotation!==0){const i=e.length();e.x=i*Math.cos(n.rotation),e.y=i*Math.sin(n.rotation)}}function v0(n,e){e||(e={});const i=n.split(";");for(let r=0;r<i.length;r++){const o=i[r].split(":"),s=o[0],a=o[1];if(typeof s>"u"||typeof a>"u")continue;const l=s.replace(/\s/g,""),c=a.replace(/\s/g,"");e[l]=c}return e}function S0(n){const e={},i=B0(n),r=Math.max(i.length,n.style.length);for(let o=0;o<r;o++){const s=n.style[o],a=i[o];s&&(e[s]=n.style[s]),a&&(e[a]=n.getAttribute(a))}return e}function B0(n){const e=n.getAttributeNames();for(let i=0;i<Sd.length;i++){const r=Sd[i],o=Array.prototype.indexOf.call(e,r);o>=0&&e.splice(o,1)}return e}function N0(n,e){const i=e.split(/[\s,]/),r=-parseFloat(i[0]),o=-parseFloat(i[1]),s=parseFloat(i[2]),a=parseFloat(i[3]);if(r&&o)for(let f=0;f<n.children.length;f++){const h=n.children[f];"translation"in h?h.translation.add(r,o):"x"in h?h.x=r:"y"in h&&(h.y=o)}const l=typeof n.x=="number",c=typeof n.y=="number",d=typeof n.width=="number",u=typeof n.height=="number";return l&&(n.translation.x+=n.x),c&&(n.translation.y+=n.y),(d||u)&&(n.scale=new re(1,1)),d&&(n.scale.x=n.width/s),u&&(n.scale.y=n.height/a),n.mask=new di(0,0,s,a),n.mask.origin.set(-s/2,-a/2),n}function on(n,e,i){const r={},o={},s={};let a,l,c,d,u,f,h,p,m,g,b,y,_,k,x,v,B;if(n===null)return r;if(Ke.getComputedStyle){const w=Ke.getComputedStyle(n);for(a=w.length;a--;)c=w[a],d=w[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<n.attributes.length;a++)f=n.attributes[a],/style/i.test(f.nodeName)?v0(f.value,s):o[f.nodeName]=f.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),i&&oe.defaults(r,i),oe.extend(r,s,o),r.visible=!(typeof r.display>"u"&&/none/i.test(r.display))||typeof r.visibility>"u"&&/hidden/i.test(r.visibility);for(c in r)switch(d=r[c],c){case"gradientTransform":if(/none/i.test(d)||(l=n.gradientTransform&&n.gradientTransform.baseVal&&n.gradientTransform.baseVal.length>0?n.gradientTransform.baseVal[0].matrix:n.getCTM?n.getCTM():null,l===null))break;switch(h=ki(l),e._renderer.type){case"linear-gradient":Bd(h,e.left),Bd(h,e.right);break;case"radial-gradient":e.center.x+=h.translateX,e.center.y+=h.translateY,e.focal.x+=h.translateX,e.focal.y+=h.translateY,e.radius*=Math.max(h.scaleX,h.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=n.transform&&n.transform.baseVal&&n.transform.baseVal.length>0?n.transform.baseVal[0].matrix:n.getCTM?n.getCTM():null,l===null))break;h=ki(l),e.translation.set(h.translateX,h.translateY),e.rotation=Math.PI*(h.rotation/180),e.scale=new re(h.scaleX,h.scaleY),p=parseFloat((r.x+"").replace("px")),m=parseFloat((r.y+"").replace("px")),p&&(e.translation.x=p),m&&(e.translation.y=m);break;case"visible":if(e instanceof gt){e._visible=d;break}e.visible=d;break;case"stroke-linecap":if(e instanceof gt){e._cap=d;break}e.cap=d;break;case"stroke-linejoin":if(e instanceof gt){e._join=d;break}e.join=d;break;case"stroke-miterlimit":if(e instanceof gt){e._miter=d;break}e.miter=d;break;case"stroke-width":if(e instanceof gt){e._linewidth=parseFloat(d);break}e.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(e instanceof gt){e._opacity=parseFloat(d);break}e.opacity=parseFloat(d);break;case"clip-path":if(Bn.cssBackgroundImage.test(d)&&(g=d.replace(Bn.cssBackgroundImage,"$1"),Ue.defs.current&&Ue.defs.current.contains(g)&&(y=Ue.defs.current.get(g),y&&y.childNodes.length>0)))switch(y=y.childNodes[0],_=Pr(y.nodeName),e.mask=Ue[_].call(this,y,{}),e._renderer.type){case"text":case"path":e.position.add(e.mask.position),e.mask.position.clear();break}break;case"fill":case"stroke":u=(e instanceof gt?"_":"")+c,Bn.cssBackgroundImage.test(d)?(g=d.replace(Bn.cssBackgroundImage,"$1"),Ue.defs.current&&Ue.defs.current.contains(g)?(y=Ue.defs.current.get(g),y.object||(_=Pr(y.nodeName),y.object=Ue[_].call(this,y,{})),y=y.object):(b=$0(this),y=b.getById(g)),e[u]=y):e[u]=d;break;case"id":e.id=d;break;case"class":case"className":e.classList=d.split(" "),e._flagClassName=!0;break;case"x":case"y":if(k=e instanceof ut,x=e instanceof Ge,v=e instanceof Ze,k||x||v)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Ht("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),e.translation[c]=parseFloat(d);break;case"font-family":e instanceof Sn&&(e.family=d);break;case"font-size":e instanceof Sn&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Ht("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),e.size=parseFloat(d));break;case"font-weight":e instanceof Sn&&(e.weight=d);break;case"font-style":e instanceof Sn&&(e.style=d);break;case"text-decoration":e instanceof Sn&&(e.decoration=d);break;case"line-height":e instanceof Sn&&(e.leading=d);break}return Object.keys(n.dataset).length&&(e.dataset=n.dataset),r}function T0(n,e){for(let i=0,r=n.childNodes.length;i<r;i++){const o=n.childNodes[i];!o.id||Pr(n.nodeName)==="#text"||e.add(o.id,o)}}function $0(n){for(;n.parent;)n=n.parent;return n.scene}var Ue={svg:function(n){const e=Ue.defs.current=new ho,i=n.getElementsByTagName("defs");for(let m=0;m<i.length;m++)T0(i[m],e);const r=Ue.g.call(this,n),o=n.getAttribute("viewBox"),s=n.getAttribute("x"),a=n.getAttribute("y"),l=n.getAttribute("width"),c=n.getAttribute("height");r.defs=e;const d=o!==null,u=s!==null,f=a!==null,h=l!==null,p=c!==null;return u&&(r.x=parseFloat(s.replace(Bn.unitSuffix,""))),f&&(r.y=parseFloat(a.replace(Bn.unitSuffix,""))),h&&(r.width=parseFloat(l.replace(Bn.unitSuffix,""))),p&&(r.height=parseFloat(c.replace(Bn.unitSuffix,""))),d&&N0(r,o),delete Ue.defs.current,r},defs:function(n){return null},use:function(n,e){let i;const r=n.getAttribute("href")||n.getAttribute("xlink:href");if(!r)return i=new Ht("encountered <use /> with no href."),console.warn(i.name,i.message),null;const o=r.slice(1);if(!Ue.defs.current.contains(o))return i=new Ht("unable to find element for reference "+r+"."),console.warn(i.name,i.message),null;const a=Ue.defs.current.get(o).cloneNode(!0);for(let c=0;c<n.attributes.length;c++){const d=n.attributes[c],u=x0.includes(d.nodeName),f=!a.hasAttribute(d.nodeName);(u||f)&&a.setAttribute(d.nodeName,d.value)}const l=Pr(a.nodeName);return Ue[l].call(this,a,e)},g:function(n,e){const i=new gt;on.call(this,n,i,e),this.add(i);const r=S0.call(this,n);for(let o=0,s=n.childNodes.length;o<s;o++){const a=n.childNodes[o],l=a.nodeName;if(!l)return;const c=Pr(l);if(c in Ue){const d=Ue[c].call(i,a,r);d&&!d.parent&&i.add(d)}}return i},polygon:function(n,e){let i;typeof n=="string"?i=n:i=n.getAttribute("points");const r=[];i.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(s,a,l){r.push(new Ee(parseFloat(a),parseFloat(l)))});const o=new Pe(r,!0);return o.stroke="none",o.fill="black",on.call(this,n,o,e),o},polyline:function(n,e){const i=Ue.polygon.call(this,n,e);return i.closed=!1,i},path:function(n,e){let i;typeof n=="string"?(i=n,n=null):i=n.getAttribute("d");let r=[],o=!1,s=!1;if(i){let l=new Ee,c,d,u=i.match(/[a-df-z][^a-df-z]*/gi);const f=u.length-1;oe.each(u.slice(0),function(h,p){const m=h.slice(1).trim().match(Bn.path),g=h[0],b=g.toLowerCase();let y,_,k,x,v;const B=[];switch(p===0&&(u=[]),b){case"h":case"v":m.length>1&&(y=1);break;case"m":case"l":case"t":m.length>2&&(y=2);break;case"s":case"q":m.length>4&&(y=4);break;case"c":m.length>6&&(y=6);break;case"a":m.length>7&&(y=7);break}if(y){for(_=0,k=m.length,v=0;_<k;_+=y){if(x=g,v>0)switch(g){case"m":x="l";break;case"M":x="L";break}B.push(x+m.slice(_,_+y).join(" ")),v++}u=Array.prototype.concat.apply(u,B)}else u.push(h)}),oe.each(u,function(h,p){let m,g,b;const y=h[0],_=y.toLowerCase();d=h.slice(1).trim().match(Bn.path),s=y===_;let k,x,v,B,w,T,C,$,E,I,R,O,U,Q,G,W,D;switch(_){case"z":if(p>=f)o=!0;else{g=l.x,b=l.y,m=new Ee(g,b,void 0,void 0,void 0,void 0,ne.close);for(let L=r.length-1;L>=0;L--){const z=r[L];if(/m/i.test(z.command)){l=z;break}}}break;case"m":case"l":c=void 0,g=parseFloat(d[0]),b=parseFloat(d[1]),m=new Ee(g,b,void 0,void 0,void 0,void 0,/m/i.test(_)?ne.move:ne.line),s&&m.addSelf(l),l=m;break;case"h":case"v":I=/h/i.test(_)?"x":"y",R=/x/i.test(I)?"y":"x",m=new Ee(void 0,void 0,void 0,void 0,void 0,void 0,ne.line),m[I]=parseFloat(d[0]),m[R]=l[R],s&&(m[I]+=l[I]),l=m;break;case"c":case"s":k=l.x,x=l.y,c||(c=new re),/c/i.test(_)?(v=parseFloat(d[0]),B=parseFloat(d[1]),w=parseFloat(d[2]),T=parseFloat(d[3]),C=parseFloat(d[4]),$=parseFloat(d[5])):(E=Os(l,c,s),v=E.x,B=E.y,w=parseFloat(d[0]),T=parseFloat(d[1]),C=parseFloat(d[2]),$=parseFloat(d[3])),s&&(v+=k,B+=x,w+=k,T+=x,C+=k,$+=x),l.controls.right.set(v-l.x,B-l.y),m=new Ee(C,$,w-C,T-$,void 0,void 0,ne.curve),l=m,c=m.controls.left;break;case"t":case"q":k=l.x,x=l.y,c||(c=new re),/q/i.test(_)?(v=parseFloat(d[0]),B=parseFloat(d[1]),w=parseFloat(d[0]),T=parseFloat(d[1]),C=parseFloat(d[2]),$=parseFloat(d[3])):(E=Os(l,c,s),v=E.x,B=E.y,w=E.x,T=E.y,C=parseFloat(d[0]),$=parseFloat(d[1])),s&&(v+=k,B+=x,w+=k,T+=x,C+=k,$+=x),l.controls.right.set((v-l.x)*.33,(B-l.y)*.33),m=new Ee(C,$,w-C,T-$,void 0,void 0,ne.curve),l=m,c=m.controls.left;break;case"a":k=l.x,x=l.y,U=parseFloat(d[0]),Q=parseFloat(d[1]),G=parseFloat(d[2]),W=parseFloat(d[3]),D=parseFloat(d[4]),C=parseFloat(d[5]),$=parseFloat(d[6]),s&&(C+=k,$+=x),O=new Ee(C,$),O.command=ne.arc,O.rx=U,O.ry=Q,O.xAxisRotation=G,O.largeArcFlag=W,O.sweepFlag=D,m=O,l=O,c=void 0;break}m&&(Array.isArray(m)?r=r.concat(m):r.push(m))})}i=new Pe(r,o,void 0,!0),i.stroke="none",i.fill="black";const a=i.getBoundingClientRect(!0);return a.centroid={x:a.left+a.width/2,y:a.top+a.height/2},oe.each(i.vertices,function(l){l.subSelf(a.centroid)}),on.call(this,n,i,e),i.translation.addSelf(a.centroid),i},circle:function(n,e){const i=parseFloat(n.getAttribute("cx")),r=parseFloat(n.getAttribute("cy")),o=parseFloat(n.getAttribute("r")),s=new ko(0,0,o);return s.stroke="none",s.fill="black",on.call(this,n,s,e),s.translation.x=i,s.translation.y=r,s},ellipse:function(n,e){const i=parseFloat(n.getAttribute("cx")),r=parseFloat(n.getAttribute("cy")),o=parseFloat(n.getAttribute("rx")),s=parseFloat(n.getAttribute("ry")),a=new Co(0,0,o,s);return a.stroke="none",a.fill="black",on.call(this,n,a,e),a.translation.x=i,a.translation.y=r,a},rect:function(n,e){const i=parseFloat(n.getAttribute("rx")),r=parseFloat(n.getAttribute("ry"));if(!oe.isNaN(i)||!oe.isNaN(r))return Ue["rounded-rect"](n);const o=parseFloat(n.getAttribute("width")),s=parseFloat(n.getAttribute("height")),a=o/2,l=s/2,c=new di(0,0,o,s);return c.stroke="none",c.fill="black",on.call(this,n,c,e),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(n,e){const i=parseFloat(n.getAttribute("rx"))||0,r=parseFloat(n.getAttribute("ry"))||0,o=parseFloat(n.getAttribute("width")),s=parseFloat(n.getAttribute("height")),a=o/2,l=s/2,c=new re(i,r),d=new vo(0,0,o,s,c);return d.stroke="none",d.fill="black",on.call(this,n,d,e),d.translation.x+=a,d.translation.y+=l,d},line:function(n,e){const i=parseFloat(n.getAttribute("x1")),r=parseFloat(n.getAttribute("y1")),o=parseFloat(n.getAttribute("x2")),s=parseFloat(n.getAttribute("y2")),a=new No(i,r,o,s).noFill();return on.call(this,n,a,e),a},lineargradient:function(n,e){let i=n.getAttribute("gradientUnits"),r=n.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(n.getAttribute("x1")||0),s=parseFloat(n.getAttribute("y1")||0),a=parseFloat(n.getAttribute("x2")||0),l=parseFloat(n.getAttribute("y2")||0);const c=(a+o)/2,d=(l+s)/2;/userSpaceOnUse/i.test(i)&&(o-=c,s-=d,a-=c,l-=d);const u=[];for(let h=0;h<n.children.length;h++){const p=n.children[h];let m=p.getAttribute("offset");/%/gi.test(m)&&(m=parseFloat(m.replace(/%/gi,""))/100),m=parseFloat(m);let g=p.getAttribute("stop-color"),b=p.getAttribute("stop-opacity"),y=p.getAttribute("style"),_;g===null&&(_=y?y.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,g=_&&_.length>1?_[1]:void 0),b===null?(_=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=_&&_.length>1?parseFloat(_[1]):1):b=parseFloat(b),u.push(new ci(m,g,b))}const f=new Ge(o,s,a,l,u);return f.spread=r,f.units=i,on.call(this,n,f,e),f},radialgradient:function(n,e){let i=n.getAttribute("gradientUnits"),r=n.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(n.getAttribute("cx"))||0,s=parseFloat(n.getAttribute("cy"))||0,a=parseFloat(n.getAttribute("r")),l=parseFloat(n.getAttribute("fx")),c=parseFloat(n.getAttribute("fy"));oe.isNaN(l)&&(l=o),oe.isNaN(c)&&(c=s);const d=Math.abs(o+l)/2,u=Math.abs(s+c)/2;/userSpaceOnUse/i.test(i)&&(o-=d,s-=u,l-=d,c-=u);const f=[];for(let p=0;p<n.children.length;p++){const m=n.children[p];let g=m.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let b=m.getAttribute("stop-color"),y=m.getAttribute("stop-opacity"),_=m.getAttribute("style"),k;b===null&&(k=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,b=k&&k.length>1?k[1]:void 0),y===null?(k=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=k&&k.length>1?parseFloat(k[1]):1):y=parseFloat(y),f.push(new ci(g,b,y))}const h=new Ze(o,s,a,f,l,c);return h.spread=r,h.units=i,on.call(this,n,h,e),h},text:function(n,e){const i=k0(n.getAttribute("text-anchor"))||"left",r=C0(n)||"baseline";let o="";n.childNodes.length>0&&n.childNodes[0].tagName==="TSPAN"?o=n.childNodes[0].textContent:o=n.textContent;const s=new Sn(o);return on.call(this,n,s,e),s.alignment=i,s.baseline=r,s},clippath:function(n,e){return Ue.defs.current&&!Ue.defs.current.contains(n.id)&&Ue.defs.current.add(n.id,n),null},image:function(n,e){let i;const r=n.getAttribute("href")||n.getAttribute("xlink:href");if(!r)return i=new Ht("encountered <image /> with no href."),console.warn(i.name,i.message),null;const o=parseFloat(n.getAttribute("x"))||0,s=parseFloat(n.getAttribute("y"))||0,a=parseFloat(n.getAttribute("width")),l=parseFloat(n.getAttribute("height")),c=new xo(r,o,s);return oe.isNaN(a)||(c.width=a),oe.isNaN(l)||(c.height=l),on.call(this,n,c,e),c}};function Nd(n,e){const i=new XMLHttpRequest;return i.open("GET",n),i.onreadystatechange=function(){i.readyState===4&&i.status===200&&e(i.responseText)},i.send(),i}var la=class Dn extends di{constructor(e,i,r,o,s,a){super(i,r,o||1,s||1),S(this,"_flagTexture",!1),S(this,"_flagMode",!1),S(this,"_texture",null),S(this,"_mode","fill"),this._renderer.type="image";for(let l in $d)Object.defineProperty(this,l,$d[l]);this.noStroke(),this.noFill(),e instanceof ze?this.texture=e:typeof e=="string"&&(this.texture=new ze(e)),typeof a=="string"&&(this.mode=a),this._update()}static fromObject(e){const i=new Dn().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Dn.Properties.length;i++){const r=Dn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new Dn(this.texture,this.translation.x,this.translation.y,this.width,this.height);return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image",e.texture=this.texture.toObject(),e.mode=this.mode,e}dispose(){return super.dispose(),this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture;if(e&&(this._flagTexture&&(this.fill=e),e.loaded)){const i=e.image.width,r=e.image.height,o=this.width,s=this.height,a=o/i,l=s/r;switch(this._mode){case Dn.Modes.fill:{const c=Math.max(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="repeat";break}case Dn.Modes.fit:{const c=Math.min(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="no-repeat";break}case Dn.Modes.crop:break;case Dn.Modes.tile:{e.offset.x=(i-o)/2,e.offset.y=(r-s)/2,e.repeat="repeat";break}case Dn.Modes.stretch:default:e.scale=new re(a,l),e.offset.x=0,e.offset.y=0,e.repeat="repeat"}}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagTexture=this._flagMode=!1,this}};S(la,"Modes",{fill:"fill",fit:"fit",crop:"crop",tile:"tile",stretch:"stretch"}),S(la,"Properties",["texture","mode"]);var Td=la,$d={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},mode:{enumerable:!0,get:function(){return this._mode},set:function(n){this._mode=n,this._flagMode=!0}}},ca=[],da=Math.max,E0=Math.min,Ed=Math.abs,To=Math.sin,$o=Math.cos,R0=Math.acos,Eo=Math.sqrt,Ve={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(n){return n in Ve?n:"path"},group:{renderChild:function(n){const e=Ve.getRendererType(n._renderer.type);Ve[e].render.call(n,this.ctx,!0,this.clip)},render:function(n){if(!this._visible)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);const r=this._mask,o=Ro(e),s=!o||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=n,s&&(n.save(),o||n.transform(e[0],e[3],e[1],e[4],e[2],e[5])),r){const a=Ve.getRendererType(r._renderer.type);Ve[a].render.call(r,n,!0)}if(this._opacity>0&&this._scale!==0)for(let a=0;a<this.children.length;a++){const l=this.children[a],c=Ve.getRendererType(l._renderer.type);Ve[c].render.call(l,n)}return s&&n.restore(),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(n,e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_,k,x,v,B,w,T,C,$,E,I,R,O,U,Q,G,W,D,L;if(L=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,U=this._mask,Q=this._clip,l=this._opacity*(L||1),c=this._visible,!e&&(!c||Q||l===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,d=this._cap,u=this._join,f=this._miter,h=this._closed,p=this._renderer.vertices,m=p.length,g=m-1,G=Ro(r),D=this.dashes,G||(n.save(),n.transform(r[0],r[3],r[1],r[4],r[2],r[5])),U){const A=Ve.getRendererType(U._renderer.type);Ve[A].render.call(U,n,!0)}if(a)if(typeof a=="string")n.fillStyle=a;else{const A=Ve.getRendererType(a._renderer.type);Ve[A].render.call(a,n,this),n.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")n.strokeStyle=o;else{const A=Ve.getRendererType(o._renderer.type);Ve[A].render.call(o,n,this),n.strokeStyle=o._renderer.effect}s&&(n.lineWidth=vn(this)),f&&(n.miterLimit=f),u&&(n.lineJoin=u),!h&&d&&(n.lineCap=d)}typeof l=="number"&&(n.globalAlpha=l),D&&D.length>0&&(n.lineDashOffset=D.offset||0,n.setLineDash(D)),n.beginPath();let z,P,q,K,J,Y,V;for(let A=0;A<m;A++)switch(_=p[A],R=_.x,O=_.y,_.command){case ne.close:n.closePath();break;case ne.arc:z=_.rx,P=_.ry,q=_.xAxisRotation,K=_.largeArcFlag,J=_.sweepFlag,b=h?st(A-1,m):da(A-1,0),y=p[b],Y=y.x,V=y.y,Ve.renderSvgArcCommand(n,Y,V,z,P,K,J,q,R,O);break;case ne.curve:b=h?st(A-1,m):Math.max(A-1,0),y=p[b],C=y.controls&&y.controls.right||re.zero,$=_.controls&&_.controls.left||re.zero,y._relative?(w=C.x+y.x,T=C.y+y.y):(w=C.x,T=C.y),_._relative?(v=$.x+_.x,B=$.y+_.y):(v=$.x,B=$.y),n.bezierCurveTo(w,T,v,B,R,O),A>=g&&h&&(k=x,E=_.controls&&_.controls.right||re.zero,I=k.controls&&k.controls.left||re.zero,_._relative?(w=E.x+_.x,T=E.y+_.y):(w=E.x,T=E.y),k._relative?(v=I.x+k.x,B=I.y+k.y):(v=I.x,B=I.y),R=k.x,O=k.y,n.bezierCurveTo(w,T,v,B,R,O));break;case ne.line:n.lineTo(R,O);break;case ne.move:x=_,n.moveTo(R,O);break}return h&&n.closePath(),!Q&&!i&&(Ve.isHidden.test(a)||(W=a._renderer&&a._renderer.offset,W&&(n.save(),n.translate(-a._renderer.offset.x,-a._renderer.offset.y),n.scale(a._renderer.scale.x,a._renderer.scale.y)),n.fill(),W&&n.restore()),Ve.isHidden.test(o)||(W=o._renderer&&o._renderer.offset,W&&(n.save(),n.translate(-o._renderer.offset.x,-o._renderer.offset.y),n.scale(o._renderer.scale.x,o._renderer.scale.y),n.lineWidth=s/o._renderer.scale.x),n.stroke(),W&&n.restore())),G||n.restore(),Q&&!i&&n.clip(),D&&D.length>0&&n.setLineDash(ca),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(n,e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_;if(_=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(_||1),c=this._visible,!e&&(!c||l===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,u=this._renderer.collection,f=u.length,g=Ro(r),y=this.dashes,d=this._size,g||(n.save(),n.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")n.fillStyle=a;else{const v=Ve.getRendererType(a._renderer.type);Ve[v].render.call(a,n,this),n.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")n.strokeStyle=o;else{const v=Ve.getRendererType(o._renderer.type);Ve[v].render.call(o,n,this),n.strokeStyle=o._renderer.effect}s&&(n.lineWidth=vn(this))}typeof l=="number"&&(n.globalAlpha=l),y&&y.length>0&&(n.lineDashOffset=y.offset||0,n.setLineDash(y)),n.beginPath();let k=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=ki(x[0],x[3],x[1],x[4],x[2],x[5]),k/=Math.max(x.scaleX,x.scaleY));for(let v=0;v<f;v++)h=u[v],p=h.x,m=h.y,n.moveTo(p+k,m),n.arc(p,m,k,0,tt);return i||(Ve.isHidden.test(a)||(b=a._renderer&&a._renderer.offset,b&&(n.save(),n.translate(-a._renderer.offset.x,-a._renderer.offset.y),n.scale(a._renderer.scale.x,a._renderer.scale.y)),n.fill(),b&&n.restore()),Ve.isHidden.test(o)||(b=o._renderer&&o._renderer.offset,b&&(n.save(),n.translate(-o._renderer.offset.x,-o._renderer.offset.y),n.scale(o._renderer.scale.x,o._renderer.scale.y),n.lineWidth=s/o._renderer.scale.x),n.stroke(),b&&n.restore())),g||n.restore(),y&&y.length>0&&n.setLineDash(ca),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(n,e,i){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*r,s=this._visible,a=this._mask,l=this._clip;if(!e&&(!s||l||o===0))return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,u=this._linewidth,f=this._fill,h=this._decoration,p=this._direction,m=Ro(c),g=f._renderer&&f._renderer.offset&&d._renderer&&d._renderer.offset,b=this.dashes,y=Ve.alignments[this._alignment]||this._alignment,_=Ve.baselines[this._baseline]||this._baseline;let k,x,v,B,w,T,C,$,E,I,R;if(m||(n.save(),n.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const O=Ve.getRendererType(a._renderer.type);Ve[O].render.call(a,n,!0)}if(g||(n.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),n.textAlign=y,n.textBaseline=_,n.direction=p,f)if(typeof f=="string")n.fillStyle=f;else{const O=Ve.getRendererType(f._renderer.type);Ve[O].render.call(f,n,this),n.fillStyle=f._renderer.effect}if(d){if(typeof d=="string")n.strokeStyle=d;else{const O=Ve.getRendererType(d._renderer.type);Ve[O].render.call(d,n,this),n.strokeStyle=d._renderer.effect}u&&(n.lineWidth=vn(this))}if(typeof o=="number"&&(n.globalAlpha=o),b&&b.length>0&&(n.lineDashOffset=b.offset||0,n.setLineDash(b)),!l&&!i&&(Ve.isHidden.test(f)||(f._renderer&&f._renderer.offset?(T=f._renderer.scale.x,C=f._renderer.scale.y,n.save(),n.translate(-f._renderer.offset.x,-f._renderer.offset.y),n.scale(T,C),k=this._size/f._renderer.scale.y,x=this._leading/f._renderer.scale.y,n.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),v=f._renderer.offset.x/f._renderer.scale.x,B=f._renderer.offset.y/f._renderer.scale.y,n.fillText(this.value,v,B),n.restore()):n.fillText(this.value,0,0)),Ve.isHidden.test(d)||(d._renderer&&d._renderer.offset?(T=d._renderer.scale.x,C=d._renderer.scale.y,n.save(),n.translate(-d._renderer.offset.x,-d._renderer.offset.y),n.scale(T,C),k=this._size/d._renderer.scale.y,x=this._leading/d._renderer.scale.y,n.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),v=d._renderer.offset.x/d._renderer.scale.x,B=d._renderer.offset.y/d._renderer.scale.y,w=u/d._renderer.scale.x,n.lineWidth=w,n.strokeText(this.value,v,B),n.restore()):n.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(h)){const O=n.measureText(this.value);let U=1;switch(h){case"underline":E=O.actualBoundingBoxDescent,R=O.actualBoundingBoxDescent;break;case"strikethrough":E=0,R=0,U=.5;break}switch(_){case"top":E+=this._size*U,R+=this._size*U;break;case"baseline":case"bottom":E-=this._size*U,R-=this._size*U;break}switch(y){case"left":case"start":$=0,I=O.width;break;case"right":case"end":$=-O.width,I=0;break;default:$=-O.width/2,I=O.width/2}n.lineWidth=Math.max(Math.floor(this._size/15),1),n.strokeStyle=n.fillStyle,n.beginPath(),n.moveTo($,E),n.lineTo(I,R),n.stroke()}return m||n.restore(),l&&!i&&n.clip(),b&&b.length>0&&n.setLineDash(ca),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=n.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,a=(a-.5)*i.height*.5,l*=Math.min(i.width,i.height)),this._renderer.effect=n.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=n.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,e&&(this._renderer.offset.x+=e.width/2,this._renderer.offset.y+=e.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(n,e,i,r,o,s,a,l,c,d){l=l*Math.PI/180,r=Ed(r),o=Ed(o);const u=(e-c)/2,f=(i-d)/2,h=$o(l)*u+To(l)*f,p=-To(l)*u+$o(l)*f,m=h*h,g=p*p;let b=r*r,y=o*o;const _=m/b+g/y;if(_>1){const O=Eo(_);r=O*r,o=O*o,b=r*r,y=o*o}const k=b*g+y*m,x=(b*y-k)/k;let v=Eo(da(0,x));s===a&&(v=-v);const B=v*r*p/o,w=-v*o*h/r,T=$o(l)*B-To(l)*w+(e+c)/2,C=To(l)*B+$o(l)*w+(i+d)/2,$=Rd(1,0,(h-B)/r,(p-w)/o),E=Rd((h-B)/r,(p-w)/o,(-h-B)/r,(-p-w)/o)%tt,I=$+E;P0(n,T,C,r,o,$,I,a===0,l)}},St=class extends ee{constructor(n){super();const e=n.smoothing!==!1;this.domElement=n.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=n.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=e),this.scene=new gt,this.scene.parent=this}setSize(n,e,i){return this.width=n,this.height=e,this.ratio=typeof i>"u"?zs(this.ctx):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&oe.extend(this.domElement.style,{width:n+"px",height:e+"px"}),this.trigger(ee.Types.resize,n,e,i)}render(){const n=this.ratio===1;return n||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Ve.group.render.call(this.scene,this.ctx),n||this.ctx.restore(),this}};S(St,"Utils",Ve);function P0(n,e,i,r,o,s,a,l,c){const d=a-s,u=Qi.Tolerance.epsilon,f=Math.abs(d)<u;let h=st(d,tt);h<u&&(f?h=0:h=tt),l===!0&&!f&&(h===tt?h=-tt:h=h-tt);for(let p=0;p<Ct.Resolution;p++){const m=p/(Ct.Resolution-1),g=s+m*h;let b=e+r*Math.cos(g),y=i+o*Math.sin(g);if(c!==0){const _=Math.cos(c),k=Math.sin(c),x=b-e,v=y-i;b=x*_-v*k+e,y=x*k+v*_+i}n.lineTo(b,y)}}function Rd(n,e,i,r){const o=n*i+e*r,s=Eo(n*n+e*e)*Eo(i*i+r*r);let a=R0(da(-1,E0(1,o/s)));return n*r-e*i<0&&(a=-a),a}function Ro(n){return n[0]===1&&n[3]===0&&n[1]===0&&n[4]===1&&n[2]===0&&n[5]===0}var ue={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},baselines:{top:"hanging",middle:"middle",bottom:"ideographic",baseline:"alphabetic"},createElement:function(n,e){const i=n,r=document.createElementNS(ue.ns,i);return i==="svg"&&(e=oe.defaults(e||{},{version:ue.version})),e&&Object.keys(e).length>0&&ue.setAttributes(r,e),r},setAttributes:function(n,e){const i=Object.keys(e);for(let r=0;r<i.length;r++)/href/.test(i[r])?n.setAttributeNS(ue.xlink,i[r],e[i[r]]):n.setAttribute(i[r],e[i[r]]);return this},removeAttributes:function(n,e){for(let i in e)n.removeAttribute(i);return this},toString:function(n,e){let i=n.length,r=i-1,o,s="";for(let a=0;a<i;a++){const l=n[a],c=e?st(a-1,i):Math.max(a-1,0),d=n[c];let u,f,h,p,m,g,b,y,_,k,x,v,B,w,T,C=Oe(l.x),$=Oe(l.y);switch(l.command){case ne.close:u=ne.close;break;case ne.arc:x=l.rx,v=l.ry,B=l.xAxisRotation,w=l.largeArcFlag,T=l.sweepFlag,u=ne.arc+" "+x+" "+v+" "+B+" "+w+" "+T+" "+C+" "+$;break;case ne.curve:b=d.controls&&d.controls.right||re.zero,y=l.controls&&l.controls.left||re.zero,d.relative?(h=Oe(b.x+d.x),p=Oe(b.y+d.y)):(h=Oe(b.x),p=Oe(b.y)),l.relative?(m=Oe(y.x+l.x),g=Oe(y.y+l.y)):(m=Oe(y.x),g=Oe(y.y)),u=(a===0?ne.move:ne.curve)+" "+h+" "+p+" "+m+" "+g+" "+C+" "+$;break;case ne.move:o=l,u=ne.move+" "+C+" "+$;break;default:u=l.command+" "+C+" "+$}a>=r&&e&&(l.command===ne.curve&&(f=o,_=l.controls&&l.controls.right||l,k=f.controls&&f.controls.left||f,l.relative?(h=Oe(_.x+l.x),p=Oe(_.y+l.y)):(h=Oe(_.x),p=Oe(_.y)),f.relative?(m=Oe(k.x+f.x),g=Oe(k.y+f.y)):(m=Oe(k.x),g=Oe(k.y)),C=Oe(f.x),$=Oe(f.y),u+=" C "+h+" "+p+" "+m+" "+g+" "+C+" "+$),l.command!==ne.close&&(u+=" Z")),s+=u+" "}return s},pointsToString:function(n,e){let i="";const r=e*.5;for(let o=0;o<n.length;o++){const s=n[o].x,a=n[o].y-r;i+=ne.move+" "+s+" "+a+" ",i+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return i},getClip:function(n,e){let i=n._renderer.clip;return i||(i=n._renderer.clip=ue.createElement("clipPath",{"clip-rule":"nonzero"})),i.parentNode===null&&e.defs.appendChild(i),i},getRendererType:function(n){return n in ue?n:"path"},defs:{update:function(n){const{defs:e}=n;if(e._flagUpdate){const i=Array.prototype.slice.call(e.children,0);for(let r=0;r<i.length;r++){const o=i[r],s=o.id,a=`[fill="url(#${s})"],[stroke="url(#${s})"],[clip-path="url(#${s})"]`;n.querySelector(a)||e.removeChild(o)}e._flagUpdate=!1}}},group:{appendChild:function(n){const e=n._renderer.elem;if(!e)return;const i=e.nodeName;!i||/(radial|linear)gradient/i.test(i)||n._clip||this.elem.appendChild(e)},removeChild:function(n){const e=n._renderer.elem;!e||e.parentNode!=this.elem||!e.nodeName||n._clip||this.elem.removeChild(e)},orderChild:function(n){this.elem.appendChild(n._renderer.elem)},renderChild:function(n){const e=ue.getRendererType(n._renderer.type);ue[e].render.call(n,this)},render:function(n){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=ue.createElement("g",{id:this.id}),n.appendChild(this._renderer.elem));const e=this._matrix.manual||this._flagMatrix,i={domElement:n,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const o=this.children[r],s=ue.getRendererType(o._renderer.type);ue[s].render.call(o,n)}if(this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(ue.group.appendChild,i),this._flagSubtractions&&this.subtractions.forEach(ue.group.removeChild,i),this._flagOrder&&this.children.forEach(ue.group.orderChild,i),this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.dataset&&Object.assign(this._renderer.elem.dataset,this.dataset),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(n){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices){const r=ue.toString(this._renderer.vertices,this._closed);e.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,n,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=vn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("path",e),n.appendChild(this._renderer.elem)),this._flagClip){const r=ue.getClip(this,n),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(n){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const s=this.worldMatrix.elements,a=ki(s[0],s[3],s[1],s[4],s[2],s[5]);r/=Math.max(a.scaleX,a.scaleY)}const o=ue.pointsToString(this._renderer.collection,r);e.d=o}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,n,!0)}return this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=vn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("path",e),n.appendChild(this._renderer.elem)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(n){this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=ue.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["dominant-baseline"]=ue.baselines[this._baseline]||this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._flagDirection&&(e.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,n,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=vn(this)),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("text",e),n.appendChild(this._renderer.elem)),this._flagClip){const r=ue.getClip(this,n),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(n,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?ue.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=ue.createElement("linearGradient",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?ue.setAttributes(s._renderer.elem,a):s._renderer.elem=ue.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(n,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagCenter&&(i.cx=this.center._x,i.cy=this.center._y),this._flagFocal&&(i.fx=this.focal._x,i.fy=this.focal._y),this._flagRadius&&(i.r=this._radius),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?ue.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=ue.createElement("radialGradient",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?ue.setAttributes(s._renderer.elem,a):s._renderer.elem=ue.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(n,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={},r={x:0,y:0},o=this.image;if(this._flagId&&(i.id=this._id),this._flagLoaded&&this.loaded)switch(o.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=o.toDataURL("image/png");break;case"img":case"image":r.href=r["xlink:href"]=this.src;break}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(i.x=this._offset.x,i.y=this._offset.y,o&&(i.x-=o.width/2,i.y-=o.height/2,this._scale instanceof re?(i.x*=this._scale.x,i.y*=this._scale.y):(i.x*=this._scale,i.y*=this._scale)),i.x>0&&(i.x*=-1),i.y>0&&(i.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,o)){switch(i.width=o.width,i.height=o.height,this._repeat){case"no-repeat":i.width+=1,i.height+=1;break}this._scale instanceof re?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale),/no-repeat/i.test(this._repeat)?r.preserveAspectRatio="xMidYMid":r.preserveAspectRatio="none",r.width=i.width,r.height=i.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?ue.setAttributes(this._renderer.image,r):this._renderer.image=ue.createElement("image",r)),this._renderer.elem?Object.keys(i).length!==0&&ue.setAttributes(this._renderer.elem,i):(i.id=this._id,i.patternUnits="userSpaceOnUse",this._renderer.elem=ue.createElement("pattern",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},Pd=class extends ee{constructor(n){super(),this.domElement=n.domElement||ue.createElement("svg"),this.scene=new gt,this.scene.parent=this,this.defs=ue.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(n,e){return this.width=n,this.height=e,ue.setAttributes(this.domElement,{width:n,height:e}),this.trigger(ee.Types.resize,n,e)}render(){return ue.group.render.call(this.scene,this.domElement),ue.defs.update(this.domElement),this}};S(Pd,"Utils",ue);var sn={create:function(n,e,i){const r=n.createShader(n[i]);if(n.shaderSource(r,e),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS)){const s=n.getShaderInfoLog(r);throw n.deleteShader(r),new Ht("unable to compile shader "+r+": "+s)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
|
|
40
|
+
***************************************************************************** */var uo=function(){return uo=Object.assign||function(e){for(var i,r=1,o=arguments.length;r<o;r++){i=arguments[r];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},uo.apply(this,arguments)},ng={scale:1,zoom:!0,infiniteZoom:!0,actualSize:!0,showZoomInOutIcons:!1,actualSizeIcons:{zoomIn:"lg-zoom-in",zoomOut:"lg-zoom-out"},enableZoomAfter:300,zoomPluginStrings:{zoomIn:"Zoom in",zoomOut:"Zoom out",viewActualSize:"View actual size"}},Ln={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Es=500,ig=(function(){function n(e,i){return this.core=e,this.$LG=i,this.settings=uo(uo({},ng),this.core.settings),this}return n.prototype.buildTemplates=function(){var e=this.settings.showZoomInOutIcons?'<button id="'+this.core.getIdName("lg-zoom-in")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomIn+'" class="lg-zoom-in lg-icon"></button><button id="'+this.core.getIdName("lg-zoom-out")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomOut+'" class="lg-zoom-out lg-icon"></button>':"";this.settings.actualSize&&(e+='<button id="'+this.core.getIdName("lg-actual-size")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.viewActualSize+'" class="'+this.settings.actualSizeIcons.zoomIn+' lg-icon"></button>'),this.core.outer.addClass("lg-use-transition-for-zoom"),this.core.$toolbar.first().append(e)},n.prototype.enableZoom=function(e){var i=this,r=this.settings.enableZoomAfter+e.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&e.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){i.isImageSlide(i.core.index)&&(i.core.getSlideItem(e.detail.index).addClass("lg-zoomable"),e.detail.index===i.core.index&&i.setZoomEssentials())},r+30)},n.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(Ln.slideItemLoad+".zoom",this.enableZoom.bind(this))},n.prototype.getDragCords=function(e){return{x:e.pageX,y:e.pageY}},n.prototype.getSwipeCords=function(e){var i=e.touches[0].pageX,r=e.touches[0].pageY;return{x:i,y:r}},n.prototype.getDragAllowedAxises=function(e,i){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),o=0,s=0,a=r.getBoundingClientRect();e?(o=r.offsetHeight*e,s=r.offsetWidth*e):i?(o=a.height+i*a.height,s=a.width+i*a.width):(o=a.height,s=a.width);var l=o>this.containerRect.height,c=s>this.containerRect.width;return{allowX:c,allowY:l}},n.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},n.prototype.zoomImage=function(e,i,r,o){if(!(!this.containerRect||Math.abs(i)<=0)){var s=this.containerRect.width/2+this.containerRect.left,a=this.containerRect.height/2+this.containerRect.top+this.scrollTop,l,c;e===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,i),u=d.allowY,f=d.allowX;this.positionChanged&&(l=this.left/(this.scale-i),c=this.top/(this.scale-i),this.pageX=s-l,this.pageY=a-c,this.positionChanged=!1);var h=this.getPossibleSwipeDragCords(i),p,m,g=s-this.pageX,b=a-this.pageY;if(e-i>1){var y=(e-i)/Math.abs(i);g=(i<0?-g:g)+this.left*(y+(i<0?-1:1)),b=(i<0?-b:b)+this.top*(y+(i<0?-1:1)),p=g/y,m=b/y}else{var y=(e-i)*i;p=g*y,m=b*y}r&&(f?this.isBeyondPossibleLeft(p,h.minX)?p=h.minX:this.isBeyondPossibleRight(p,h.maxX)&&(p=h.maxX):e>1&&(p<h.minX?p=h.minX:p>h.maxX&&(p=h.maxX)),u?this.isBeyondPossibleTop(m,h.minY)?m=h.minY:this.isBeyondPossibleBottom(m,h.maxY)&&(m=h.maxY):e>1&&(m<h.minY?m=h.minY:m>h.maxY&&(m=h.maxY))),this.setZoomStyles({x:p,y:m,scale:e}),this.left=p,this.top=m,o&&this.setZoomImageSize()}},n.prototype.resetImageTranslate=function(e){if(this.isImageSlide(e)){var i=this.core.getSlideItem(e).find(".lg-image").first();this.imageReset=!1,i.removeClass("reset-transition reset-transition-y reset-transition-x"),this.core.outer.removeClass("lg-actual-size"),i.css("width","auto").css("height","auto"),setTimeout(function(){i.removeClass("no-transition")},10)}},n.prototype.setZoomImageSize=function(){var e=this,i=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=e.getCurrentImageActualSizeScale();e.scale>=r&&(i.addClass("no-transition"),e.imageReset=!0)},Es),setTimeout(function(){var r=e.getCurrentImageActualSizeScale();if(e.scale>=r){var o=e.getDragAllowedAxises(e.scale);i.css("width",i.get().naturalWidth+"px").css("height",i.get().naturalHeight+"px"),e.core.outer.addClass("lg-actual-size"),o.allowX&&o.allowY?i.addClass("reset-transition"):o.allowX&&!o.allowY?i.addClass("reset-transition-x"):!o.allowX&&o.allowY&&i.addClass("reset-transition-y")}},Es+50)},n.prototype.setZoomStyles=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),o=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=e.scale,r.css("transform","scale3d("+e.scale+", "+e.scale+", 1)"),o.css("transform","scale3d("+e.scale+", "+e.scale+", 1)");var s="translate3d("+e.x+"px, "+e.y+"px, 0)";i.css("transform",s)},n.prototype.setActualSize=function(e,i){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var o=this.core.galleryItems[this.core.index];this.resetImageTranslate(e),setTimeout(function(){if(!(!o.src||r.core.outer.hasClass("lg-first-slide-loading"))){var s=r.getCurrentImageActualSizeScale(),a=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(s),r.setPageCords(i),r.beginZoom(r.scale),r.zoomImage(r.scale,r.scale-a,!0,!0)}},50),setTimeout(function(){r.core.outer.removeClass("lg-grabbing").addClass("lg-grab")},60),setTimeout(function(){r.zoomInProgress=!1},Es+110)}},n.prototype.getNaturalWidth=function(e){var i=this.core.getSlideItem(e).find(".lg-image").first(),r=this.core.galleryItems[e].width;return r?parseFloat(r):i.get().naturalWidth},n.prototype.getActualSizeScale=function(e,i){var r,o;return e>=i?(r=e/i,o=r||2):o=1,o},n.prototype.getCurrentImageActualSizeScale=function(){var e=this.core.getSlideItem(this.core.index).find(".lg-image").first(),i=e.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||i;return this.getActualSizeScale(r,i)},n.prototype.getPageCords=function(e){var i={};if(e)i.x=e.pageX||e.touches[0].pageX,i.y=e.pageY||e.touches[0].pageY;else{var r=this.core.$content.get().getBoundingClientRect();i.x=r.width/2+r.left,i.y=r.height/2+this.scrollTop+r.top}return i},n.prototype.setPageCords=function(e){var i=this.getPageCords(e);this.pageX=i.x,this.pageY=i.y},n.prototype.manageActualPixelClassNames=function(){var e=this.core.getElementById("lg-actual-size");e.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},n.prototype.beginZoom=function(e){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),e>1},n.prototype.getScale=function(e){var i=this.getCurrentImageActualSizeScale();return e<1?e=1:e>i&&(e=i),e},n.prototype.init=function(){var e=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var i=null;this.core.outer.on("dblclick.lg",function(r){e.$LG(r.target).hasClass("lg-image")&&e.setActualSize(e.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var o=e.$LG(r.target);r.touches.length===1&&o.hasClass("lg-image")&&(i?(clearTimeout(i),i=null,r.preventDefault(),e.setActualSize(e.core.index,r)):i=setTimeout(function(){i=null},300))}),this.core.LGel.on(Ln.containerResize+".zoom "+Ln.rotateRight+".zoom "+Ln.rotateLeft+".zoom "+Ln.flipHorizontal+".zoom "+Ln.flipVertical+".zoom",function(){if(!(!e.core.lgOpened||!e.isImageSlide(e.core.index)||e.core.touchAction)){var r=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();e.top=0,e.left=0,e.setZoomEssentials(),e.setZoomSwipeStyles(r,{x:0,y:0}),e.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){e.core.lgOpened&&(e.scrollTop=e.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(e.isImageSlide(e.core.index)){var r=0;e.imageReset&&(e.resetImageTranslate(e.core.index),r=50),setTimeout(function(){var o=e.scale-e.settings.scale;o<1&&(o=1),e.beginZoom(o),e.zoomImage(o,-e.settings.scale,!0,!e.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){e.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){e.setActualSize(e.core.index)}),this.core.LGel.on(Ln.beforeOpen+".zoom",function(){e.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(Ln.afterOpen+".zoom",function(){e.scrollTop=e.$LG(window).scrollTop(),e.pageX=e.core.outer.width()/2,e.pageY=e.core.outer.height()/2+e.scrollTop,e.scale=1}),this.core.LGel.on(Ln.afterSlide+".zoom",function(r){var o=r.detail.prevIndex;e.scale=1,e.positionChanged=!1,e.zoomInProgress=!1,e.resetZoom(o),e.resetImageTranslate(o),e.isImageSlide(e.core.index)&&e.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},n.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var e=this.scale+this.settings.scale;this.settings.infiniteZoom||(e=this.getScale(e)),this.beginZoom(e),this.zoomImage(e,Math.min(this.settings.scale,e-this.scale),!0,!this.settings.infiniteZoom)}},n.prototype.resetZoom=function(e){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var i=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(e!==void 0?e:this.core.index);i.removeClass(this.settings.actualSizeIcons.zoomOut).addClass(this.settings.actualSizeIcons.zoomIn),r.find(".lg-img-wrap").first().removeAttr("style"),r.find(".lg-image").first().removeAttr("style"),this.scale=1,this.left=0,this.top=0,this.setPageCords()},n.prototype.getTouchDistance=function(e){return Math.sqrt((e.touches[0].pageX-e.touches[1].pageX)*(e.touches[0].pageX-e.touches[1].pageX)+(e.touches[0].pageY-e.touches[1].pageY)*(e.touches[0].pageY-e.touches[1].pageY))},n.prototype.pinchZoom=function(){var e=this,i=0,r=!1,o=1,s=0,a=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(l){if(a=e.core.getSlideItem(e.core.index),!!e.isImageSlide(e.core.index)&&l.touches.length===2){if(l.preventDefault(),e.core.outer.hasClass("lg-first-slide-loading"))return;o=e.scale||1,e.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e.setPageCords(l),e.resetImageTranslate(e.core.index),e.core.touchAction="pinch",i=e.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=e.getTouchDistance(l),d=i-c;if(!r&&Math.abs(d)>5&&(r=!0),r){s=e.scale;var u=Math.max(1,o+-d*.02);e.scale=Math.round((u+Number.EPSILON)*100)/100;var f=e.scale-s;e.zoomImage(e.scale,Math.round((f+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,i=0,e.scale<=1)e.resetZoom();else{var c=e.getCurrentImageActualSizeScale();if(e.scale>=c){var d=c-e.scale;d===0&&(d=.01),e.zoomImage(c,d,!1,!0)}e.manageActualPixelClassNames(),e.core.outer.addClass("lg-zoomed")}e.core.touchAction=void 0}})},n.prototype.touchendZoom=function(e,i,r,o,s){var a=i.x-e.x,l=i.y-e.y,c=Math.abs(a)/s+1,d=Math.abs(l)/s+1;c>2&&(c+=1),d>2&&(d+=1),a=a*c,l=l*d;var u=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),f={};f.x=this.left+a,f.y=this.top+l;var h=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(o&&(this.isBeyondPossibleTop(f.y,h.minY)?f.y=h.minY:this.isBeyondPossibleBottom(f.y,h.maxY)&&(f.y=h.maxY)),r&&(this.isBeyondPossibleLeft(f.x,h.minX)?f.x=h.minX:this.isBeyondPossibleRight(f.x,h.maxX)&&(f.x=h.maxX)),o?this.top=f.y:f.y=this.top,r?this.left=f.x:f.x=this.left,this.setZoomSwipeStyles(u,f),this.positionChanged=!0)},n.prototype.getZoomSwipeCords=function(e,i,r,o,s){var a={};if(o){if(a.y=this.top+(i.y-e.y),this.isBeyondPossibleTop(a.y,s.minY)){var l=s.minY-a.y;a.y=s.minY-l/6}else if(this.isBeyondPossibleBottom(a.y,s.maxY)){var c=a.y-s.maxY;a.y=s.maxY+c/6}}else a.y=this.top;if(r){if(a.x=this.left+(i.x-e.x),this.isBeyondPossibleLeft(a.x,s.minX)){var d=s.minX-a.x;a.x=s.minX-d/6}else if(this.isBeyondPossibleRight(a.x,s.maxX)){var u=a.x-s.maxX;a.x=s.maxX+u/6}}else a.x=this.left;return a},n.prototype.isBeyondPossibleLeft=function(e,i){return e>=i},n.prototype.isBeyondPossibleRight=function(e,i){return e<=i},n.prototype.isBeyondPossibleTop=function(e,i){return e>=i},n.prototype.isBeyondPossibleBottom=function(e,i){return e<=i},n.prototype.isImageSlide=function(e){var i=this.core.galleryItems[e];return this.core.getSlideType(i)==="image"},n.prototype.getPossibleSwipeDragCords=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,o=i.get().getBoundingClientRect(),s=o.height,a=o.width;e&&(s=s+e*s,a=a+e*a);var l=(s-this.containerRect.height)/2,c=(this.containerRect.height-s)/2+r,d=(a-this.containerRect.width)/2,u=(this.containerRect.width-a)/2,f={minY:l,maxY:c,minX:d,maxX:u};return f},n.prototype.setZoomSwipeStyles=function(e,i){e.css("transform","translate3d("+i.x+"px, "+i.y+"px, 0)")},n.prototype.zoomSwipe=function(){var e=this,i={},r={},o=!1,s=!1,a=!1,l=new Date,c=new Date,d,u,f=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(h){if(e.isImageSlide(e.core.index)&&(f=e.core.getSlideItem(e.core.index),(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))&&h.touches.length===1&&e.core.outer.hasClass("lg-zoomed"))){h.preventDefault(),l=new Date,e.core.touchAction="zoomSwipe",u=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var p=e.getDragAllowedAxises(0);a=p.allowY,s=p.allowX,(s||a)&&(i=e.getSwipeCords(h)),d=e.getPossibleSwipeDragCords(),e.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(h){if(h.touches.length===1&&e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){h.preventDefault(),e.core.touchAction="zoomSwipe",r=e.getSwipeCords(h);var p=e.getZoomSwipeCords(i,r,s,a,d);(Math.abs(r.x-i.x)>15||Math.abs(r.y-i.y)>15)&&(o=!0,e.setZoomSwipeStyles(u,p))}}),this.core.$inner.on("touchend.lg",function(h){if(e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){if(h.preventDefault(),e.core.touchAction=void 0,e.core.outer.removeClass("lg-zoom-dragging"),!o)return;o=!1,c=new Date;var p=c.valueOf()-l.valueOf();e.touchendZoom(i,r,s,a,p)}})},n.prototype.zoomDrag=function(){var e=this,i={},r={},o=!1,s=!1,a=!1,l=!1,c,d,u,f;this.core.outer.on("mousedown.lg.zoom",function(h){if(e.isImageSlide(e.core.index)){var p=e.core.getSlideItem(e.core.index);if(e.$LG(h.target).hasClass("lg-item")||p.get().contains(h.target)){c=new Date,f=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var m=e.getDragAllowedAxises(0);l=m.allowY,a=m.allowX,e.core.outer.hasClass("lg-zoomed")&&e.$LG(h.target).hasClass("lg-object")&&(a||l)&&(h.preventDefault(),i=e.getDragCords(h),u=e.getPossibleSwipeDragCords(),o=!0,e.core.outer.removeClass("lg-grab").addClass("lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"))}}}),this.$LG(window).on("mousemove.lg.zoom.global"+this.core.lgId,function(h){if(o){s=!0,r=e.getDragCords(h);var p=e.getZoomSwipeCords(i,r,a,l,u);e.setZoomSwipeStyles(f,p)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(h){if(o){if(d=new Date,o=!1,e.core.outer.removeClass("lg-zoom-dragging"),s&&(i.x!==r.x||i.y!==r.y)){r=e.getDragCords(h);var p=d.valueOf()-c.valueOf();e.touchendZoom(i,r,a,l,p)}s=!1}e.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},n.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},n.prototype.destroy=function(){this.$LG(window).off(".lg.zoom.global"+this.core.lgId),this.core.LGel.off(".lg.zoom"),this.core.LGel.off(".zoom"),clearTimeout(this.zoomableTimeout),this.zoomableTimeout=!1},n})();const rg={ref:"gallery-container",class:"lightgallery-wrapper"},og={},ic=t.defineComponent({...og,__name:"lightgallery",props:{settings:{},onAfterAppendSlide:{type:Function},onInit:{type:Function},onHasVideo:{type:Function},onContainerResize:{type:Function},onAfterAppendSubHtml:{type:Function},onBeforeOpen:{type:Function},onAfterOpen:{type:Function},onSlideItemLoad:{type:Function},onBeforeSlide:{type:Function},onAfterSlide:{type:Function},onPosterClick:{type:Function},onDragStart:{type:Function},onDragMove:{type:Function},onDragEnd:{type:Function},onBeforeNextSlide:{type:Function},onBeforePrevSlide:{type:Function},onBeforeClose:{type:Function},onAfterClose:{type:Function},onRotateLeft:{type:Function},onRotateRight:{type:Function},onFlipHorizontal:{type:Function},onFlipVertical:{type:Function}},setup(n){const e=n,i={lgAfterAppendSlide:e.onAfterAppendSlide,lgInit:e.onInit,lgHasVideo:e.onHasVideo,lgContainerResize:e.onContainerResize,lgAfterAppendSubHtml:e.onAfterAppendSubHtml,lgBeforeOpen:e.onBeforeOpen,lgAfterOpen:e.onAfterOpen,lgSlideItemLoad:e.onSlideItemLoad,lgBeforeSlide:e.onBeforeSlide,lgAfterSlide:e.onAfterSlide,lgPosterClick:e.onPosterClick,lgDragStart:e.onDragStart,lgDragMove:e.onDragMove,lgDragEnd:e.onDragEnd,lgBeforeNextSlide:e.onBeforeNextSlide,lgBeforePrevSlide:e.onBeforePrevSlide,lgBeforeClose:e.onBeforeClose,lgAfterClose:e.onAfterClose,lgRotateLeft:e.onRotateLeft,lgRotateRight:e.onRotateRight,lgFlipHorizontal:e.onFlipHorizontal,lgFlipVertical:e.onFlipVertical},r=t.useTemplateRef("gallery-container"),o=t.ref(null);return t.onMounted(async()=>{if(!r.value)return;const s=await import("lightgallery");o.value=s.default(r.value,{...e.settings}),M.forOwn(i,(a,l)=>{var c;a&&((c=r.value)==null||c.addEventListener(l,a))})}),t.onBeforeUnmount(()=>{var s;o.value&&((s=o.value)==null||s.destroy(),o.value=null)}),(s,a)=>(t.openBlock(),t.createElementBlock("div",rg,[t.renderSlot(s.$slots,"default")],512))}}),sg=["href"],ag=["src","alt"],lg={},rc=t.defineComponent({...lg,__name:"image-gallery",props:{images:{}},setup(n,{expose:e}){const i=t.ref(!1),r=t.ref(!1),o=t.ref({plugins:[tg,ig],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),s=()=>window.innerWidth*(Xe.getDeviceTypeByResolution()===je.phone?.7:.8),a=t.ref(s()),l=()=>{a.value=s()},c=()=>{i.value=!0};return t.onUnmounted(()=>{window.removeEventListener("resize",l)}),e({show:c}),window.addEventListener("resize",l),(d,u)=>{const f=nc,h=F.NPopover;return t.openBlock(),t.createBlock(h,{trigger:"manual",show:i.value,class:"sc-image",placement:"top-start",onClickoutside:u[3]||(u[3]=()=>{r.value||(i.value=!1)})},{trigger:t.withCtx(()=>[t.createElementVNode("div",{class:"inline-flex",onClick:u[0]||(u[0]=p=>i.value=!i.value)},[t.renderSlot(d.$slots,"default",{},()=>[t.createVNode(f)])])]),default:t.withCtx(()=>[t.createVNode(ic,{settings:o.value,style:t.normalizeStyle(`max-width: ${a.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:u[1]||(u[1]=()=>{r.value=!0}),onAfterClose:u[2]||(u[2]=()=>{r.value=!1,i.value=!1})},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.images,(p,m)=>(t.openBlock(),t.createElementBlock("a",{key:m,href:p.image},[t.createElementVNode("img",{src:p.preview,alt:`Изображение #${m+1}`},null,8,ag)],8,sg))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),cg={class:"text-sm grid grid-cols-[auto_auto] gap-x-3 gap-y-1 items-baseline"},dg={class:"pr-3"},ug={class:"text-right"},fg={},hg=t.defineComponent({...fg,__name:"product-stock-count",props:{product:{}},setup(n){return(e,i)=>{const r=lo,o=F.NPopover;return t.openBlock(),t.createBlock(o,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(r)])]),default:t.withCtx(()=>[t.createElementVNode("div",cg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.product.stockCount,(s,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:a},[t.createElementVNode("span",dg,t.toDisplayString(s.warehouse.name),1),t.createElementVNode("span",ug,[t.createTextVNode(t.toDisplayString(s.count??"В наличии")+" ",1),s.count?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(n.product.unit.name),1)],64)):t.createCommentVNode("",!0)])],64))),128))])]),_:3})}}}),mg=["innerHTML"],pg=["innerHTML"],gg={class:"m-0 flex list-none flex-col gap-1 p-0 text-sm"},yg=["href"],bg={key:1,class:"text-sm text-gray-500"},_g={},Rs=t.defineComponent({..._g,__name:"product-info-content",props:{product:{},size:{default:"medium"},maxHeight:{default:void 0},activeTab:{default:void 0}},setup(n){const e=n,i=t.computed(()=>e.maxHeight?{maxHeight:e.maxHeight}:void 0),r=t.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.description)??""}),o=t.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.specification)??""}),s=t.computed(()=>Ts(e.product)),a=t.computed(()=>[r.value?"description":null,o.value?"specification":null,s.value.length>0?"files":null].filter(c=>c!==null)),l=t.ref(e.activeTab&&a.value.includes(e.activeTab)?e.activeTab:a.value[0]);return(c,d)=>{const u=F.NScrollbar,f=F.NTabPane,h=F.NTabs;return a.value.length>0?(t.openBlock(),t.createBlock(h,{key:0,value:l.value,"onUpdate:value":d[0]||(d[0]=p=>l.value=p),size:n.size,type:"line",class:"sc-product-info-content"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createBlock(f,{key:0,name:"description",tab:"Описание"},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("div",{class:"sc-product-info-html",innerHTML:r.value},null,8,mg)]),_:1},8,["style"])]),_:1})):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createBlock(f,{key:1,name:"specification",tab:"Характеристики"},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("div",{class:"sc-product-info-html",innerHTML:o.value},null,8,pg)]),_:1},8,["style"])]),_:1})):t.createCommentVNode("",!0),s.value.length>0?(t.openBlock(),t.createBlock(f,{key:2,name:"files",tab:`Файлы (${s.value.length})`},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("ul",gg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,p=>(t.openBlock(),t.createElementBlock("li",{key:p.id},[t.createElementVNode("a",{href:p.url,target:"_blank",rel:"noopener"},t.toDisplayString(p.typeName),9,yg)]))),128))])]),_:1},8,["style"])]),_:1},8,["tab"])):t.createCommentVNode("",!0)]),_:1},8,["value","size"])):(t.openBlock(),t.createElementBlock("span",bg," Описание, характеристики и файлы не заданы. "))}}}),wg={key:0,class:"flex flex-row gap-2.5"},xg={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},kg={},Ps=t.defineComponent({...kg,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},modalWidth:{default:void 0},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})},trapFocus:{type:Boolean,default:!0}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.show),a=t.ref(r.processing),l=Xe.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=Xe.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=t.computed(()=>r.modalWidth??window.innerWidth*c.value),u=()=>{o("opening"),s.value=!0,o("update:show",s.value)},f=(p="other",m=!1)=>{if(a.value&&!m){o("processing:cancel",_=>{a.value=_});return}let g=!1;o("closing",p,()=>{g=!0}),g||(s.value=!1,o("update:show",s.value))},h=()=>{o("accept",m=>{a.value=m})};return t.watch(()=>r.show,p=>{p?u():f("other",!0)}),t.watch(()=>r.processing,p=>{a.value=p}),e({open:u,close:f,acceptHandler:h}),(p,m)=>{const g=F.NButton,b=F.NModal;return t.openBlock(),t.createBlock(b,{loading:a.value,show:s.value,"show-icon":!1,size:t.unref(l),style:t.normalizeStyle(`width: ${d.value}px`),title:n.title,"trap-focus":n.trapFocus??!0,"action-class":p.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:m[1]||(m[1]=y=>f("header")),onEsc:m[2]||(m[2]=y=>f("esc")),onMaskClick:m[3]||(m[3]=y=>f("mask"))},t.createSlots({default:t.withCtx(()=>[t.renderSlot(p.$slots,"default")]),_:2},[p.$slots.header?{name:"header",fn:t.withCtx(()=>[t.renderSlot(p.$slots,"header")]),key:"0"}:void 0,p.$slots.action||p.$slots["extra-action"]||n.acceptButton.show||n.cancelButton.show?{name:"action",fn:t.withCtx(()=>[p.$slots["extra-action"]?(t.openBlock(),t.createElementBlock("div",wg,[t.renderSlot(p.$slots,"extra-action")])):t.createCommentVNode("",!0),p.$slots.action||n.acceptButton.show||n.cancelButton.show?(t.openBlock(),t.createElementBlock("div",xg,[t.renderSlot(p.$slots,"action",{disabled:a.value}),n.acceptButton.show??!0?(t.openBlock(),t.createBlock(g,{key:0,disabled:a.value||!n.valid,loading:a.value,size:t.unref(l),type:"primary",onClick:h},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","loading","size"])):t.createCommentVNode("",!0),n.cancelButton.show??!0?(t.openBlock(),t.createBlock(g,{key:1,disabled:a.value,size:t.unref(l),type:"default",onClick:m[0]||(m[0]=y=>f("footer"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.cancelButton.text??"Отмена"),1)]),_:1},8,["disabled","size"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","trap-focus","action-class"])}}}),Cg={class:"flex flex-col gap-3"},vg={class:"text-xs text-gray-500"},Sg={},oc=t.defineComponent({...Sg,__name:"product-info-dialog",props:{product:{},show:{type:Boolean,default:!1},activeTab:{default:void 0}},emits:["update:show"],setup(n,{emit:e}){const i=e,r=()=>{i("update:show",!1)};return(o,s)=>(t.openBlock(),t.createBlock(Ps,{show:n.show,title:n.product.name,"accept-button":{show:!1},"cancel-button":{show:!0,text:"Закрыть"},"trap-focus":!1,onClosing:r},{default:t.withCtx(()=>[t.createElementVNode("div",Cg,[t.createElementVNode("span",vg,"Артикул: "+t.toDisplayString(n.product.code),1),t.createVNode(Rs,{product:n.product,"active-tab":n.activeTab,"max-height":"60vh"},null,8,["product","active-tab"])])]),_:1},8,["show","title"]))}}),Bg={class:"flex flex-col gap-2"},Ng={class:"flex justify-end border-0 border-t border-solid border-gray-200 pt-2"},Tg={},sc=t.defineComponent({...Tg,__name:"product-info-popover",props:{product:{}},setup(n){const e=t.ref(!1),i=t.ref(!1),r=t.ref(!1),o=()=>{e.value=!1,i.value=!0,r.value=!0};return(s,a)=>{const l=lo,c=F.NButton,d=F.NPopover;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(d,{show:e.value,"onUpdate:show":a[0]||(a[0]=u=>e.value=u),width:560,style:{maxWidth:"calc(100vw - 2rem)"},trigger:"click",placement:"bottom-start",class:"sc-product-info-popover"},{trigger:t.withCtx(()=>[t.renderSlot(s.$slots,"default",{},()=>[t.createVNode(l,{title:"Описание и характеристики",class:"cursor-pointer"})])]),default:t.withCtx(()=>[t.createElementVNode("div",Bg,[t.createVNode(Rs,{product:n.product,size:"small","max-height":"16rem"},null,8,["product"]),t.createElementVNode("div",Ng,[t.createVNode(c,{text:"",type:"info",size:"small",onClick:o},{default:t.withCtx(()=>[...a[2]||(a[2]=[t.createTextVNode(" Открыть полностью ",-1)])]),_:1})])])]),_:3},8,["show"]),i.value?(t.openBlock(),t.createBlock(oc,{key:0,show:r.value,"onUpdate:show":a[1]||(a[1]=u=>r.value=u),product:n.product},null,8,["show","product"])):t.createCommentVNode("",!0)],64)}}}),$g={class:"flex flex-row justify-between"},Eg={key:0,class:"inline-flex flex-row gap-0.5 mr-2 align-sub"},Rg={key:1},Pg={class:"ml-2 align-sub"},Fg={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},Vg={key:2,class:"ml-2 align-sub"},Mg={class:"@container"},Ig={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},Ag={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},Og={class:"text-sc-dark-grey"},zg={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},Dg={class:"text-gray-600"},Lg={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},Hg={key:3,class:"underline decoration-dashed"},Wg={key:4,class:"sc-product-pack whitespace-nowrap"},jg={class:"text-gray-600"},qg={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},Xg={class:"text-gray-600"},Yg={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},Ug={key:0},Kg={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Gg={},Tr=t.defineComponent({...Gg,__name:"product-name",props:{product:{},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showCode:{type:Boolean,default:!0},showProductCosts:{type:[Boolean,Function],default:!1},showPlanningDates:{type:Boolean,default:!0},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showAdditionalSaleIcon:{type:Boolean,default:!1},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(n,{expose:e}){const i=n,r=t.computed(()=>M.isFunction(i.showProductCosts)?i.showProductCosts(i.product):i.showProductCosts),o=t.computed(()=>M.sortBy(i.product.priceCoefficients,["coefficient.slug"])),s=t.computed(()=>{var h,p;return(p=(h=i.product)==null?void 0:h.properties)==null?void 0:p.planingIncomingDate}),a=t.useTemplateRef("image-gallery"),l=()=>{var h;(h=a.value)==null||h.show()},c=t.computed(()=>M.isFunction(i.allowNameClick)?i.allowNameClick(i.product):i.allowNameClick),d=t.computed(()=>(M.isFunction(i.showProductInfoButton)?i.showProductInfoButton(i.product):i.showProductInfoButton)&&Kl(i.product)),u=t.computed(()=>{var h;return i.showProductAddToCartButton||i.showProductEditButton||i.showProductRequiredButton||(((h=i.productContextButtonsConfig)==null?void 0:h.length)??0)>0}),f=()=>{var h;c.value&&((h=i.eventEmitter)==null||h.emit("product:name-click",{product:i.product,exposedMethods:{showProductImagesPreview:l}}))};return e({showProductImagesPreview:l}),(h,p)=>{var w,T,C,$;const m=Jp,g=F.NTooltip,b=ec,y=Gp,_=nc,k=F.NText,x=tc,v=lo,B=F.NScrollbar;return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",$g,[t.createVNode(k,{type:"info",class:"sc-product-name text-balance text-base font-medium text-black"},{default:t.withCtx(()=>{var E,I,R,O;return[(E=n.product)!=null&&E.isFavorite||(I=n.product)!=null&&I.isPreviouslyOrdered||n.showAdditionalSaleIcon?(t.openBlock(),t.createElementBlock("div",Eg,[((R=n.product)==null?void 0:R.isFavorite)??!1?(t.openBlock(),t.createBlock(g,{key:0,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(m,{class:"!text-yellow-300"})]),default:t.withCtx(()=>[p[0]||(p[0]=t.createTextVNode(" Избранный товар ",-1))]),_:1})):t.createCommentVNode("",!0),((O=n.product)==null?void 0:O.isPreviouslyOrdered)??!1?(t.openBlock(),t.createBlock(g,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(b,{class:"!text-green-700"})]),default:t.withCtx(()=>[p[1]||(p[1]=t.createTextVNode(" Ранее заказанный товар ",-1))]),_:1})):t.createCommentVNode("",!0),n.showAdditionalSaleIcon?(t.openBlock(),t.createBlock(g,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(y,{class:"!text-green-500"})]),default:t.withCtx(()=>[p[2]||(p[2]=t.createTextVNode(" Дополнительная продажа ",-1))]),_:1})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass({"cursor-pointer":c.value&&n.eventEmitter,"text-gray-400 line-through":n.product.isHidden}),onClick:f},t.toDisplayString(n.product.name),3),n.product.onOrder?(t.openBlock(),t.createElementBlock("span",Rg," [Под заказ] ")):t.createCommentVNode("",!0),t.createElementVNode("span",Pg,[n.product.images&&n.product.images.length>0?(t.openBlock(),t.createBlock(rc,{key:0,ref:"image-gallery",images:n.product.images},{default:t.withCtx(()=>[t.createElementVNode("div",Fg,[t.createVNode(_)])]),_:1},8,["images"])):t.createCommentVNode("",!0)]),d.value?(t.openBlock(),t.createElementBlock("span",Vg,[t.createVNode(sc,{product:n.product},null,8,["product"])])):t.createCommentVNode("",!0)]}),_:1}),u.value?(t.openBlock(),t.createBlock(x,{key:0,product:n.product,"event-emitter":n.eventEmitter,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-edit-button":n.showProductEditButton,"show-product-required-button":n.showProductRequiredButton,"product-context-buttons-config":n.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",Mg,[t.createElementVNode("div",Ig,[n.product.supplierSku?(t.openBlock(),t.createElementBlock("div",Ag,[p[3]||(p[3]=t.createTextVNode(" Артикул производителя/поставщика: ",-1)),t.createElementVNode("span",Og,t.toDisplayString(n.product.supplierSku),1)])):t.createCommentVNode("",!0),n.showCode?(t.openBlock(),t.createElementBlock("span",zg,[p[4]||(p[4]=t.createTextVNode(" Артикул: ",-1)),t.createElementVNode("span",Dg,t.toDisplayString(n.product.code),1)])):t.createCommentVNode("",!0),n.product.stockCount&&n.product.stockCount.length>0?(t.openBlock(),t.createBlock(hg,{key:2,product:n.product},{default:t.withCtx(()=>[t.createElementVNode("span",Lg,[p[5]||(p[5]=t.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),t.createVNode(v,{class:"mt-0.5"})])]),_:1},8,["product"])):(t.openBlock(),t.createElementBlock("span",Hg," Нет в наличии ")),n.product.pack??((T=(w=n.product)==null?void 0:w.properties)==null?void 0:T.pack)?(t.openBlock(),t.createElementBlock("span",Wg,[p[6]||(p[6]=t.createTextVNode(" Норма упаковки: ",-1)),t.createElementVNode("span",jg,t.toDisplayString(n.product.pack??(($=(C=n.product)==null?void 0:C.properties)==null?void 0:$.pack)),1)])):t.createCommentVNode("",!0),n.showPlanningDates&&s.value?(t.openBlock(),t.createElementBlock("span",qg,[p[7]||(p[7]=t.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),t.createElementVNode("span",Xg,t.toDisplayString(s.value),1)])):t.createCommentVNode("",!0)])]),t.createVNode(B,{"x-scrollable":""},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",Yg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,E=>(t.openBlock(),t.createBlock(ai,{key:E.coefficient.slug,product:n.product,"cost-field-name":E.coefficient.slug??"","event-emitter":n.eventEmitter,"allow-price-click":n.allowPriceClick,"show-tag":!0,"show-price-history":n.showPriceHistory,"currency-rates":n.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),t.createVNode(ai,{product:n.product,"event-emitter":n.eventEmitter,"allow-price-click":n.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":n.showCostDate,"show-price-history":n.showPriceHistory,"currency-rates":n.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):t.createCommentVNode("",!0)]),_:1}),n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",Ug,[t.createElementVNode("ul",Kg,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.product.id,slug:n.product.slug},(E,I)=>(t.openBlock(),t.createElementBlock("li",{key:I}," ("+t.toDisplayString(I)+"): "+t.toDisplayString(E),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.product.properties,(E,I)=>(t.openBlock(),t.createElementBlock("li",{key:I}," ("+t.toDisplayString(I)+"): "+t.toDisplayString(E),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)])}}}),Zg=(n,e,i)=>({key:n,title:e,className:"align-top",resizable:!0,render:r=>t.h(ai,{product:r,costFieldName:n,eventEmitter:i.eventEmitter,allowPriceClick:i.allowPriceClick,currencyRates:i.currencyRates})}),Qg=(n,e)=>{if(n.length===0)return[];const i=[],r={};switch(M.isNil(e.isProductItemSelected)||i.push({key:"checkbox",title:"",className:"align-top",width:"32",render:o=>{var s,a;return t.h(F.NCheckbox,{checked:!!((s=e.isProductItemSelected)!=null&&s.call(e,o)),disabled:((a=e.isProductItemSelected)==null?void 0:a.call(e,o))==="disabled",onUpdateChecked:l=>{e.eventEmitter.emit("product:checked",{product:o,checked:l})}})}}),Xe.getDeviceTypeByResolution()){case je.phone:case je.tablet:i.push({key:"name",title:"Наименование",className:"align-top",render:o=>t.h(Tr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig})});break;default:i.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:o=>t.h(Tr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,currencyRates:e.currencyRates})}),e.showProductCosts&&(M.forEach(n,o=>{M.forEach(o.priceCoefficients,s=>{r[s.coefficient.slug??""]||(r[s.coefficient.slug??""]=s.coefficient)})}),M.forEach(M.sortBy(r,["slug"]),o=>{i.push(Zg(o.slug??"",o.name,e))}),i.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:o=>t.h(ai,{product:o,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:e.eventEmitter,allowPriceClick:e.allowPriceClick,showQuantityUnit:!0,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})})),(e.showProductEditButton||e.showProductRequiredButton||e.showProductAddToCartButton||!M.isNil(e.productContextButtonsConfig))&&i.push({key:"actions",title:"",className:"align-top",width:"50",render:o=>t.h(tc,{product:o,eventEmitter:e.eventEmitter,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,productContextButtonsConfig:e.productContextButtonsConfig})});break}return i},Jg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ey(n,e){return t.openBlock(),t.createElementBlock("svg",Jg,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",d:"M296 64h-80a7.91 7.91 0 0 0-8 8v24h96V72a7.91 7.91 0 0 0-8-8"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M432 96h-96V72a40 40 0 0 0-40-40h-80a40 40 0 0 0-40 40v24H80a16 16 0 0 0 0 32h17l19 304.92c1.42 26.85 22 47.08 48 47.08h184c26.13 0 46.3-19.78 48-47l19-305h17a16 16 0 0 0 0-32M192.57 416H192a16 16 0 0 1-16-15.43l-8-224a16 16 0 1 1 32-1.14l8 224A16 16 0 0 1 192.57 416M272 400a16 16 0 0 1-32 0V176a16 16 0 0 1 32 0Zm32-304h-96V72a7.91 7.91 0 0 1 8-8h80a7.91 7.91 0 0 1 8 8Zm32 304.57A16 16 0 0 1 320 416h-.58A16 16 0 0 1 304 399.43l8-224a16 16 0 1 1 32 1.14Z"},null,-1)])])}const fo=t.markRaw({name:"ion-trash",render:ey}),ty={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ny(n,e){return t.openBlock(),t.createElementBlock("svg",ty,[...e[0]||(e[0]=[t.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const ac=t.markRaw({name:"ion-plus",render:ny}),iy={key:0,class:"flex w-fit items-center gap-2"},ry={key:1,class:"flex flex-wrap gap-1"},oy={key:0},sy={key:2},ay={},$r=t.defineComponent({...ay,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0},validation:{default:void 0}},setup(n){const e=n,i=t.computed(()=>{var r,o;return(o=(r=e.product)==null?void 0:r.properties)==null?void 0:o.planingProductionDate});return(r,o)=>{const s=F.NSpin,a=F.NText;return n.isProductSearching?(t.openBlock(),t.createElementBlock("div",iy,[t.createVNode(s,{size:17,class:"w-fit"}),o[0]||(o[0]=t.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):n.product&&!n.product.isNewRec()?(t.openBlock(),t.createElementBlock("div",ry,[t.createElementVNode("div",null,t.toDisplayString(n.product.code)+" - "+t.toDisplayString(n.product.name)+" - "+t.toDisplayString(n.product.costRub.toLocaleString())+" ₽ / "+t.toDisplayString(n.product.unit.name),1),i.value?(t.openBlock(),t.createElementBlock("div",oy,"(Планируемая дата производства: "+t.toDisplayString(i.value)+")",1)):t.createCommentVNode("",!0)])):n.validation?(t.openBlock(),t.createElementBlock("div",sy,[t.createVNode(a,{type:n.validation.validationStatus},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.validation.feedback),1)]),_:1},8,["type"])])):t.createCommentVNode("",!0)}}}),ly={class:"flex flex-col gap-4"},cy={class:"flex flex-col gap-2"},dy={class:"mt-8 font-bold"},uy={class:"grid grow grid-cols-2 items-start gap-2"},fy={key:2,class:"text-red-500 text-sm"},hy={key:3,class:"text-red-500 text-sm mb-2"},my={class:"flex flex-col gap-4"},py={key:1},gy={class:"text-lg font-semibold"},yy={class:"flex gap-3"},by={},_y=t.defineComponent({...by,__name:"kozyrek-configurator-params-form",props:{value:{},settings:{},previewParams:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},selectTemplateIndex:{}},emits:["update:value","update:params","submit","click:add-line","click:remove-line","click:save-template"],setup(n,{expose:e,emit:i}){var b;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(!1),l=t.ref(M.cloneDeep(r.value)),c=t.computed(()=>{var _,k,x;const y={"configuratorParams.length":[le.required,le.min(r.settings.stripMinLength),le.max(r.settings.stripMaxLength||Number.MAX_VALUE),le.step(r.settings.lengthStep),He.serverValidation((_=r.validation.length)==null?void 0:_.feedback)],quantity:[le.required,le.min(1),le.step(1),He.serverValidation((k=r.validation.quantity)==null?void 0:k.feedback)],marker:[He.serverValidation((x=r.validation.marker)==null?void 0:x.feedback)]};return M.forEach(l.value.configuratorParams.linesWidths,(v,B)=>{var C;const T=l.value.configuratorParams.linesWidths.length>1?r.settings.minLineWidth:r.settings.stripMinWidth;y[`configuratorParams.linesWidths.${B}`]=[le.required,le.min(T),le.max(r.settings.maxLineWidth),le.step(r.settings.lineWidthStep),He.serverValidation((C=r.validation[`lines_widths[${B+1}]`])==null?void 0:C.feedback)]}),M.forEach(l.value.configuratorParams.linesAngles,(v,B)=>{var w;y[`configuratorParams.linesAngles.${B}`]=[le.required,le.min(r.settings.minLineAngle),le.max(r.settings.maxLineAngle),le.step(r.settings.lineAngleStep),He.serverValidation((w=r.validation[`lines_angles[${B+1}]`])==null?void 0:w.feedback)]}),y}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>{var v;const{length:y}=l.value.configuratorParams,{quantity:_}=l.value,k=((v=l.value.product)==null?void 0:v.costRub)||0;if(!y||!_||k===0)return null;const x=y/1e3;return(k*_*x).toLocaleString("ru-ru",{maximumFractionDigits:2,minimumFractionDigits:2})}),f=t.computed(()=>M.reduce(l.value.configuratorParams.linesWidths,(y,_)=>y+(_||0),0)),h=t.computed(()=>{const y=f.value;return y>=r.settings.stripMinWidth&&y<=r.settings.stripMaxWidth}),p=t.computed(()=>{const{configuratorParams:y}=l.value,_=M.every(y.linesWidths,B=>!!(B&&B>0)),k=M.every(y.linesAngles,B=>!M.isNil(B)),x=!!(l.value.quantity&&l.value.quantity>0),v=y.length>0&&y.length>0;return _&&k&&x&&v&&h.value}),m=()=>{t.nextTick(()=>{var y;(y=s.value)==null||y.validate(_=>{_||(o("update:params",l.value.configuratorParams),g("configuratorParams",l.value.configuratorParams))}).catch(M.noop)})},g=(y,_)=>{const k=new j.OrderItemBase(l.value);k[y]=_,y==="configuratorParams"&&(k.product=new j.ClientProduct),o("update:value",k)};return t.watch(()=>r.previewParams,y=>{l.value.configuratorParams.linesWidths=y.linesWidths,l.value.configuratorParams.linesAngles=y.linesAngles},{deep:!0}),t.watch(()=>r.value,y=>{l.value=M.cloneDeep(y)},{deep:!0}),e({validate:(b=s.value)==null?void 0:b.validate,formReference:s}),(y,_)=>{const k=ac,x=fo,v=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:l.value,rules:c.value,class:"flex flex-col gap-4 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var B;return[t.createElementVNode("div",ly,[_[21]||(_[21]=t.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),n.settings.startTailConfigs&&n.settings.startTailConfigs.length>0?(t.openBlock(),t.createBlock(t.unref(F.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:l.value.configuratorParams.startTailType,"onUpdate:value":[_[0]||(_[0]=w=>l.value.configuratorParams.startTailType=w),m],options:n.settings.startTailConfigs.map(({label:w},T)=>({label:w,value:T})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",cy,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value.configuratorParams.linesAngles,(w,T)=>(t.openBlock(),t.createElementBlock("div",{key:T,class:"flex items-start gap-2"},[t.createElementVNode("div",dy,t.toDisplayString(T+1),1),t.createElementVNode("div",uy,[t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.linesWidths.${T}`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.configuratorParams.linesWidths[T],"onUpdate:value":[C=>l.value.configuratorParams.linesWidths[T]=C,_[2]||(_[2]=C=>m())],parse:t.unref(ct),"show-button":!1,class:"w-full",onKeydown:_[1]||(_[1]=C=>t.unref(lt)(C)),onInput:C=>t.unref(ot)(n.validation,`lines_widths[${T+1}]`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.linesAngles.${T}`,label:"Угол сгиба, °"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.configuratorParams.linesAngles[T],"onUpdate:value":[C=>l.value.configuratorParams.linesAngles[T]=C,_[4]||(_[4]=C=>m())],parse:t.unref(ct),"show-button":!1,class:"w-full",onKeydown:_[3]||(_[3]=C=>t.unref(lt)(C,!0)),onInput:C=>t.unref(ot)(n.validation,`lines_angles[${T+1}]`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(F.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:t.withCtx(()=>[n.settings.showOnlyTemplates?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,size:"medium",onClick:C=>o("click:add-line",T)},{default:t.withCtx(()=>[t.createVNode(k)]),_:1},8,["onClick"])),n.settings.showOnlyTemplates?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:1,disabled:l.value.configuratorParams.linesWidths.length===1,size:"medium",class:"ml-2",onClick:C=>o("click:remove-line",T)},{default:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["disabled","onClick"]))]),_:2},1024)]))),128))]),n.settings.endTailConfigs&&n.settings.endTailConfigs.length>0?(t.openBlock(),t.createBlock(t.unref(F.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:l.value.configuratorParams.endTailType,"onUpdate:value":[_[5]||(_[5]=w=>l.value.configuratorParams.endTailType=w),m],options:n.settings.endTailConfigs.map(({label:w},T)=>({label:w,value:T})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):t.createCommentVNode("",!0),t.createVNode($r,{"is-product-searching":n.isProductSearching,product:l.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),h.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",fy," Суммарная ширина участков гиба должна быть от "+t.toDisplayString(n.settings.stripMinWidth)+" до "+t.toDisplayString(n.settings.stripMaxWidth)+" мм., текущая ширина: "+t.toDisplayString(f.value)+" мм. ",1)),p.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",hy," Пожалуйста, заполните все обязательные поля корректно. ")),n.settings.allowSaveTemplates&&n.selectTemplateIndex===((B=n.settings.allTemplates)==null?void 0:B.length)-1?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:4,type:"tertiary",class:"self-start",loading:a.value,onClick:_[6]||(_[6]=w=>o("click:save-template"))},{default:t.withCtx(()=>[..._[20]||(_[20]=[t.createTextVNode(" Сохранить шаблон ",-1)])]),_:1},8,["loading"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",my,[t.createVNode(t.unref(F.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:l.value.configuratorParams.colorSide,"onUpdate:value":[_[7]||(_[7]=w=>l.value.configuratorParams.colorSide=w),m],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"configuratorParams.length",label:`Метраж${n.settings.stripMinLength?" от "+n.settings.stripMinLength:""}${n.settings.stripMaxLength?" до "+n.settings.stripMaxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[_[8]||(_[8]=w=>l.value.configuratorParams.length=w),_[11]||(_[11]=w=>m())],parse:t.unref(ct),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:_[9]||(_[9]=w=>t.unref(lt)(w)),onInput:_[10]||(_[10]=w=>t.unref(ot)(n.validation,"length")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.quantity,"onUpdate:value":[_[12]||(_[12]=w=>l.value.quantity=w),_[15]||(_[15]=w=>g("quantity",w??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:_[13]||(_[13]=w=>t.unref(lt)(w,!1)),onInput:_[14]||(_[14]=w=>t.unref(ot)(n.validation,"quantity")),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:l.value.marker??null,placeholder:"Введите маркировку",onInput:_[16]||(_[16]=w=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":_[17]||(_[17]=w=>{l.value.marker=w??null,g("marker",w??null)}),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(v,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":_[18]||(_[18]=w=>{l.value.isAdditionalSale=w??!1,g("isAdditionalSale",w??!1)})},{default:t.withCtx(()=>[..._[22]||(_[22]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("div",py,[_[23]||(_[23]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",gy,t.toDisplayString(u.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",yy,[t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:!p.value||l.value.product.isNewRec(),type:"primary",class:"self-start",onClick:_[19]||(_[19]=w=>o("submit",l.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])])]}),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",l.value)]])}}}),lc=fn(_y,[["__scopeId","data-v-ac7f1192"]]);var cc=Object.defineProperty,wy=Object.defineProperties,xy=Object.getOwnPropertyDescriptors,dc=Object.getOwnPropertySymbols,ky=Object.prototype.hasOwnProperty,Cy=Object.prototype.propertyIsEnumerable,uc=n=>{throw TypeError(n)},Fs=(n,e,i)=>e in n?cc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,Er=(n,e)=>{for(var i in e||(e={}))ky.call(e,i)&&Fs(n,i,e[i]);if(dc)for(var i of dc(e))Cy.call(e,i)&&Fs(n,i,e[i]);return n},Vs=(n,e)=>wy(n,xy(e)),fc=(n,e)=>{for(var i in e)cc(n,i,{get:e[i],enumerable:!0})},S=(n,e,i)=>Fs(n,typeof e!="symbol"?e+"":e,i),hc=(n,e,i)=>e.has(n)||uc("Cannot "+i),Lt=(n,e,i)=>(hc(n,e,"read from private field"),i?i.call(n):e.get(n)),mc=(n,e,i)=>e.has(n)?uc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,i),vy=(n,e,i,r)=>(hc(n,e,"write to private field"),e.set(n,i),i),Ft={Image:null,isHeadless:!1,shim:function(n,e){return n.tagName=n.nodeName=e||"canvas",n.nodeType=1,n.getAttribute=function(i){return this[i]},n.setAttribute=function(i,r){return this[i]=r,this},n},polyfill:function(n,e){return Ft.shim(n),typeof e<"u"&&(Ft.Image=e),Ft.isHeadless=!0,n}},pc={};fc(pc,{Curve:()=>Qi,getAnchorsFromArcData:()=>Ny,getComponentOnCubicBezier:()=>Rr,getControlPoints:()=>Bc,getCurveBoundingBox:()=>Cc,getCurveFromPoints:()=>Sc,getCurveLength:()=>kc,getReflection:()=>Os,integrate:()=>vc,subdivide:()=>As});var gc={};fc(gc,{HALF_PI:()=>dt,NumArray:()=>Cn,TWO_PI:()=>tt,decomposeMatrix:()=>ki,getComputedMatrix:()=>Ms,getEffectiveStrokeWidth:()=>vn,getPoT:()=>_c,lerp:()=>Vt,mod:()=>st,setMatrix:()=>bc,toFixed:()=>Oe});var Ke;typeof window<"u"?Ke=window:typeof global<"u"?Ke=global:typeof self<"u"&&(Ke=self);var yc,tt=Math.PI*2,dt=Math.PI*.5;function ki(n,e,i,r,o,s){let a;return arguments.length<=1?(a=n.a,e=n.b,i=n.c,r=n.d,o=n.e,s=n.f):a=n,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function bc(n){yc=n}function Ms(n,e){e=e&&e.identity()||new yc;let i=n;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Vt(n,e,i){return i*(e-n)+n}var Is=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function _c(n){let e=0;for(;Is[e]&&Is[e]<n;)e++;return Is[e]}function st(n,e){for(;n<0;)n+=e;return n%e}var Cn=Ke.Float32Array||Array,Sy=Math.floor;function Oe(n){return Sy(n*1e6)/1e6}function vn(n,e){const i=n._linewidth;if(n.strokeAttenuation)return i;e||(e=n.worldMatrix||Ms(n));const r=ki(e.elements[0],e.elements[3],e.elements[1],e.elements[4],e.elements[2],e.elements[5]),o=Math.max(Math.abs(r.scaleX),Math.abs(r.scaleY));return o>0?i/o:i}var ne={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},ee=class{constructor(){S(this,"_events",{}),S(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(i)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,i!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}};S(ee,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),S(ee,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var wc={x:{enumerable:!0,get:function(){return this._x},set:function(n){this._x!==n&&(this._x=n,this._bound&&this.dispatchEvent(ee.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(n){this._y!==n&&(this._y=n,this._bound&&this.dispatchEvent(ee.Types.change))}}},hn=class _r extends ee{constructor(e=0,i=0){super(),S(this,"_x",0),S(this,"_y",0);for(let r in wc)Object.defineProperty(this,r,wc[r]);this.x=e,this.y=i}static add(e,i){return new _r(e.x+i.x,e.y+i.y)}static sub(e,i){return new _r(e.x-i.x,e.y-i.y)}static subtract(e,i){return _r.sub(e,i)}static ratioBetween(e,i){return(e.x*i.x+e.y*i.y)/(e.length()*i.length())}static angleBetween(e,i){if(arguments.length>=4){const s=arguments[0]-arguments[2],a=arguments[1]-arguments[3];return Math.atan2(a,s)}const r=e.x-i.x,o=e.y-i.y;return Math.atan2(o,r)}static distanceBetween(e,i){return Math.sqrt(_r.distanceBetweenSquared(e,i))}static distanceBetweenSquared(e,i){const r=e.x-i.x,o=e.y-i.y;return r*r+o*o}set(e,i){return this.x=e,this.y=i,this}copy(e){return this.x=e.x,this.y=e.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new _r(this.x,this.y)}add(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x+=e,this.y+=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=i),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x-=e,this.y-=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=i),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(e){return this.sub.apply(this,arguments)}subtractSelf(e){return this.sub.apply(this,arguments)}multiply(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x*=e,this.y*=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=i),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x/=e,this.y/=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=i),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(e){return this.divide.apply(this,arguments)}divideScalar(e){return this.divide(e)}negate(){return this.multiply(-1)}dot(e){return this.x*e.x+this.y*e.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const i=this.x-e.x,r=this.y-e.y;return i*i+r*r}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,i){return i=typeof i>"u"?1e-4:i,this.distanceTo(e)<i}lerp(e,i){const r=(e.x-this.x)*i+this.x,o=(e.y-this.y)*i+this.y;return this.set(r,o)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:Oe(this.x),y:Oe(this.y)}}rotate(e){const i=this.x,r=this.y,o=Math.cos(e),s=Math.sin(e);return this.x=i*o-r*s,this.y=i*s+r*o,this}};S(hn,"zero",new hn),S(hn,"left",new hn(-1,0)),S(hn,"right",new hn(1,0)),S(hn,"up",new hn(0,-1)),S(hn,"down",new hn(0,1));var re=hn,Ee=class ws extends re{constructor(e=0,i=0,r=0,o=0,s=0,a=0,l=ne.move){super(e,i),S(this,"controls",{left:new re,right:new re}),S(this,"_command",ne.move),S(this,"_relative",!0),S(this,"_rx",0),S(this,"_ry",0),S(this,"_xAxisRotation",0),S(this,"_largeArcFlag",0),S(this,"_sweepFlag",1);for(let d in xc)Object.defineProperty(this,d,xc[d]);this.command=l,this.relative=!0;const c=ws.makeBroadcast(this);this.controls.left.set(r,o).addEventListener(ee.Types.change,c),this.controls.right.set(s,a).addEventListener(ee.Types.change,c)}static makeBroadcast(e){return i;function i(){e._bound&&e.dispatchEvent(ee.Types.change)}}static fromObject(e){return new ws().copy(e)}copy(e){return this.x=e.x,this.y=e.y,typeof e.command=="string"&&(this.command=e.command),e.controls&&(e.controls.left&&this.controls.left.copy(e.controls.left),e.controls.right&&this.controls.right.copy(e.controls.right)),typeof e.relative=="boolean"&&(this.relative=e.relative),typeof e.rx=="number"&&(this.rx=e.rx),typeof e.ry=="number"&&(this.ry=e.ry),typeof e.xAxisRotation=="number"&&(this.xAxisRotation=e.xAxisRotation),typeof e.largeArcFlag=="number"&&(this.largeArcFlag=e.largeArcFlag),typeof e.sweepFlag=="number"&&(this.sweepFlag=e.sweepFlag),this}clone(){return new ws().copy(this)}toObject(){return{x:Oe(this.x),y:Oe(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Oe(this.rx),ry:Oe(this.ry),xAxisRotation:Oe(this.xAxisRotation),largeArcFlag:Oe(this.largeArcFlag),sweepFlag:Oe(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},xc={command:{enumerable:!0,get:function(){return this._command},set:function(n){this._command!==n&&(this._command=n,this._bound&&this.dispatchEvent(ee.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(n){this._relative!==!!n&&(this._relative=!!n,this._bound&&this.dispatchEvent(ee.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(n){this._rx!==n&&(this._rx=n,this._bound&&this.dispatchEvent(ee.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(n){this._ry!==n&&(this._ry=n,this._bound&&this.dispatchEvent(ee.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(n){this._xAxisRotation!==n&&(this._xAxisRotation=n,this._bound&&this.dispatchEvent(ee.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(n){this._largeArcFlag!==n&&(this._largeArcFlag=n,this._bound&&this.dispatchEvent(ee.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(n){this._sweepFlag!==n&&(this._sweepFlag=n,this._bound&&this.dispatchEvent(ee.Types.change))}}},By=0,Ct={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.23",PublishDate:"2025-12-22T19:59:24.486Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return By++}},Qi={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Rr(n,e,i,r,o){const s=1-n;return s*s*s*e+3*s*s*n*i+3*s*n*n*r+n*n*n*o}function As(n,e,i,r,o,s,a,l,c){c=c||Qi.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ee(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Rr(h,n,i,o,a),m=Rr(h,e,r,s,l);u.push(new Ee(p,m))}return u}function kc(n,e,i,r,o,s,a,l,c){if(n===i&&e===r&&o===a&&s===l){const b=a-n,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(a-n),u=6*(n+o)-12*i,f=3*(i-n),h=9*(r-s)+3*(l-e),p=6*(e+s)-12*r,m=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+p)*b+m;return Math.sqrt(y*y+_*_)}return vc(g,0,1,c||Qi.RecursionLimit)}function Cc(n,e,i,r,o,s,a,l){const c=[],d=[[],[]];let u,f,h,p,m,g,b,y;for(let v=0;v<2;++v){if(v===0?(f=6*n-12*i+6*o,u=-3*n+9*i-9*o+3*a,h=3*i-3*n):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;p=-h/f,0<p&&p<1&&c.push(p);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(m=(-f+y)/(2*u),0<m&&m<1&&c.push(m),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)p=c[_],x=1-p,d[0][_]=x*x*x*n+3*x*x*p*i+3*x*p*p*o+p*p*p*a,d[1][_]=x*x*x*e+3*x*x*p*r+3*x*p*p*s+p*p*p*l;return d[0][k]=n,d[1][k]=e,d[0][k+1]=a,d[1][k+1]=l,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function vc(n,e,i,r){let o=Qi.abscissas[r-2],s=Qi.weights[r-2],a=.5*(i-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*n(l):0;for(;c<d;){const f=a*o[c];u+=s[c++]*(n(l+f)+n(l-f))}return a*u}function Sc(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?st(o-1,i):Math.max(o-1,0),l=e?st(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];Bc(c,d,u),d.command=o===0?ne.move:ne.curve}}function Bc(n,e,i){const r=re.angleBetween(n,e),o=re.angleBetween(i,e);let s=re.distanceBetween(n,e),a=re.distanceBetween(i,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=dt:l-=dt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}function Os(n,e,i){return new re(2*n.x-(e.x+n.x)-(i?n.x:0),2*n.y-(e.y+n.y)-(i?n.y:0))}function Ny(n,e,i,r,o,s,a){const l=Ct.Resolution;for(let c=0;c<l;c++){let d=(c+1)/l;a&&(d=1-d);const u=d*s+o,f=i*Math.cos(u),h=r*Math.sin(u),p=new Ee(f,h);p.command=ne.line}}var Nc=Array.prototype.slice;function Ty(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}var oe={isNaN:function(n){return typeof n=="number"&&n!==+n},isElement:function(n){return!!(n&&n.nodeType===1)},isObject:function(n){const e=typeof n;return e==="function"||e==="object"&&!!n},isFunction:function(n){return typeof n=="function"},extend:function(n){const e=Nc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]=r[o]}return n},defaults:function(n){const e=Nc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]===void 0&&(n[o]=r[o])}return n},each:function(n,e,i){const r=i||this,o=!Ty(n)&&Object.keys(n),s=(o||n).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,n[l],l,n)}return n},performance:Ke.performance&&Ke.performance.now?Ke.performance:Date},Gt={hasEventListeners:typeof Ke.addEventListener=="function",bind:function(n,e,i,r){return this.hasEventListeners?n.addEventListener(e,i,!!r):n.attachEvent("on"+e,i),Gt},unbind:function(n,e,i,r){return Gt.hasEventListeners?n.removeEventListeners(e,i,!!r):n.detachEvent("on"+e,i),Gt},getRequestAnimationFrame:function(){const n=["ms","moz","webkit","o"];let e=0,i=Ke.requestAnimationFrame;if(!i){for(let o=0;o<n.length;o++)i=Ke[n[o]+"RequestAnimationFrame"]||i;i=i||r}function r(o,s){const a=new Date().getTime(),l=Math.max(0,16-(a-e)),c=Ke.setTimeout(d,l);e=a+l;function d(){o(a+l)}return c}return i}},Ji=Ke.document?Ke.document.createElement("div"):{};Ji.id="help-two-load",Object.defineProperty(Gt,"temp",{enumerable:!0,get:function(){return oe.isElement(Ji)&&!Ke.document.head.contains(Ji)&&(Ji.style.display="none",Ke.document.head.appendChild(Ji)),Ji}});var Ht=class extends Error{constructor(e){super(),S(this,"name","Two.js"),S(this,"message"),this.message=e}},$y=Ke.devicePixelRatio||1;function Ey(n){return n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1}function zs(n){return $y/Ey(n)}var ho=class{constructor(){S(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}},vt,li=class extends Array{constructor(){super(),mc(this,vt,new ee),arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return Lt(this,vt)}set _events(e){vy(this,vt,e)}get _bound(){return Lt(this,vt)._bound}set _bound(e){Lt(this,vt)._bound=e}addEventListener(){var e;return(e=Lt(this,vt).addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=Lt(this,vt).on)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=Lt(this,vt).bind)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=Lt(this,vt).removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=Lt(this,vt).off)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=Lt(this,vt).unbind)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=Lt(this,vt).dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=Lt(this,vt).trigger)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=Lt(this,vt).listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=Lt(this,vt).ignore)==null?void 0:e.apply(this,arguments)}pop(){const e=super.pop.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}shift(){const e=super.shift.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}push(){const e=super.push.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}unshift(){const e=super.unshift.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}splice(){const e=super.splice.apply(this,arguments);if(this.trigger(ee.Types.remove,e),arguments.length>2){const i=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ee.Types.insert,i),this.trigger(ee.Types.order)}return e}sort(){return super.sort.apply(this,arguments),this.trigger(ee.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ee.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(e,i){const r=[];for(let o=0;o<this.length;o++){const s=this[o];let a;i?a=e.call(i,s,o):a=e(s,o),r.push(a)}return r}};vt=new WeakMap;var Tc=class vm extends ee{constructor(){super(),S(this,"_flagId",!1),S(this,"_flagClassName",!1),S(this,"_renderer",{}),S(this,"_id",Ct.Identifier+Ct.uniqueId()),S(this,"_className",""),S(this,"classList",[]);for(let e in $c)Object.defineProperty(this,e,$c[e])}static fromObject(e){const i=new vm().copy(e);return"id"in e&&(i.id=e.id),i}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return e.renderer&&typeof e.renderer.type=="string"&&(this.renderer.type=e.renderer.type),typeof e.className=="string"&&(this.className=e.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const i=this.renderer.ctx;this._renderer.texture&&(i.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(i.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const e=this._renderer.type;return this._renderer={type:e},this}};S(Tc,"Properties",["renderer","id","className"]);var er=Tc,$c={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(n){const e=this._id;n!==this._id&&(this._id=n,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(n){this._className!==n&&(this._flagClassName=!0,this.classList=n.split(/\s+?/),this._className=n)}}},mo,Ec={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Ke.document&&(mo=document.createElement("a"));var mn=class tn extends er{constructor(e,i){super(),S(this,"_flagSrc",!1),S(this,"_flagImage",!1),S(this,"_flagVideo",!1),S(this,"_flagLoaded",!1),S(this,"_flagRepeat",!1),S(this,"_flagOffset",!1),S(this,"_flagScale",!1),S(this,"_src",""),S(this,"_image",null),S(this,"_loaded",!1),S(this,"_repeat","no-repeat"),S(this,"_scale",1),S(this,"_offset",null);for(let r in Rc)Object.defineProperty(this,r,Rc[r]);if(this._renderer.type="texture",this._renderer.flagOffset=Ry.bind(this),this._renderer.flagScale=Py.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new re,typeof i=="function"){const r=(function(){this.unbind(ee.Types.load,r),typeof i=="function"&&i()}).bind(this);this.bind(ee.Types.load,r)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const r=Object.prototype.toString.call(e);(r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]"||r==="[object HTMLVideoElement]"||r==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const i=new tn().copy(e);return"id"in e&&(i.id=e.id),i}static getAbsoluteURL(e){return mo?(mo.href=e,mo.href):e}static loadHeadlessBuffer(e,i){e.image.onload=i,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const i=tn.getAbsoluteURL(e);if(tn.ImageRegistry.contains(i))return tn.ImageRegistry.get(i);let r;return Ft.Image?(r=new Ft.Image,Ft.shim(r,"img")):Ke.document?Ec.video.test(i)?r=document.createElement("video"):r=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r.referrerPolicy="no-referrer",r}static load(e,i){let r=e.image,o=tn.getTag(r);e._flagImage&&(/canvas/i.test(o)?tn.Register.canvas(e,i):(e._src=!Ft.isHeadless&&r.getAttribute("two-src")||r.src,tn.Register[o](e,i))),e._flagSrc&&(r||(r=tn.getImage(e.src),e.image=r),o=tn.getTag(r),tn.Register[o](e,i))}clone(){const e=new tn(this.src);return e.repeat=this.repeat,e.offset.copy(this.offset),e.scale=this.scale,e}copy(e){return this.src=e.src,this.repeat=e.repeat,this.offset=typeof e.offset=="number"||e.offset instanceof re?e.offset:new re().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re().copy(e.scale),this}toObject(){const e=super.toObject.call(this);return e.renderer.type="texture",e.src=this.src,e.repeat=this.repeat,e.offset=this.offset.toObject(),e.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),e}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(ee.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,tn.load(this,(function(){this.loaded=!0,this.trigger(ee.Types.change).trigger(ee.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(mn,"Properties",["src","loaded","repeat","scale","offset","image"]),S(mn,"RegularExpressions",Ec),S(mn,"ImageRegistry",new ho),S(mn,"Register",{canvas:function(n,e){n._src="#"+n.id,mn.ImageRegistry.add(n.src,n.image),typeof e=="function"&&e()},img:function(n,e){const i=n.image,r=function(s){!Ft.isHeadless&&i.removeEventListener&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),typeof e=="function"&&e()},o=function(s){throw!Ft.isHeadless&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),new Ht("unable to load "+n.src)};typeof i.width=="number"&&i.width>0&&typeof i.height=="number"&&i.height>0?r():!Ft.isHeadless&&typeof i.addEventListener=="function"&&(i.addEventListener("load",r,!1),i.addEventListener("error",o,!1)),n._src=mn.getAbsoluteURL(n._src),!(!Ft.isHeadless&&i&&i.getAttribute("two-src"))&&(Ft.isHeadless||i.setAttribute("two-src",n.src),mn.ImageRegistry.add(n.src,i),Ft.isHeadless?mn.loadHeadlessBuffer(n,r):n.image.src=n.src)},video:function(n,e){if(Ft.isHeadless)throw new Ht("video textures are not implemented in headless environments.");const i=function(o){n.image.removeEventListener("canplaythrough",i,!1),n.image.removeEventListener("error",r,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof e=="function"&&e()},r=function(o){throw n.image.removeEventListener("canplaythrough",i,!1),n.image.removeEventListener("error",r,!1),new Ht("unable to load "+n.src)};n._src=mn.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),mn.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?i():(n.image.addEventListener("canplaythrough",i,!1),n.image.addEventListener("error",r,!1),n.image.src=n.src,n.image.load())}});var ze=mn,Rc={src:{enumerable:!0,get:function(){return this._src},set:function(n){this._src=n,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(n){this._loaded=n,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(n){this._repeat=n,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(n){const e=ze.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}ze.ImageRegistry.contains(i)?this._image=ze.ImageRegistry.get(n.src):this._image=n,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset&&this._offset.unbind(ee.Types.change,this._renderer.flagOffset),this._offset=n,this._offset.bind(ee.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Ry(){this._flagOffset=!0}function Py(){this._flagScale=!0}var Ds=class kn extends er{constructor(e,i,r){super(),S(this,"_flagOffset",!0),S(this,"_flagOpacity",!0),S(this,"_flagColor",!0),S(this,"_offset",0),S(this,"_opacity",1),S(this,"_color","#fff");for(let o in Pc)Object.defineProperty(this,o,Pc[o]);this._renderer.type="stop",this.offset=typeof e=="number"?e:kn.Index<=0?0:1,this.opacity=typeof r=="number"?r:1,this.color=typeof i=="string"?i:kn.Index<=0?"#fff":"#000",kn.Index=(kn.Index+1)%2}static fromObject(e){const i=new kn().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<kn.Properties.length;i++){const r=kn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new kn;return oe.each(kn.Properties,function(r){i[r]=this[r]},this),e&&e.stops&&e.stops.push(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",oe.each(kn.Properties,i=>{e[i]=this[i]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};S(Ds,"Index",0),S(Ds,"Properties",["offset","opacity","color"]);var ci=Ds,Pc={offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset=n,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(n){this._color=n,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Ls=class ji extends er{constructor(e){super(),S(this,"_flagStops",!1),S(this,"_flagSpread",!1),S(this,"_flagUnits",!1),S(this,"_spread",""),S(this,"_units","");for(let i in Fc)Object.defineProperty(this,i,Fc[i]);this._renderer.type="gradient",this._renderer.flagStops=Fy.bind(this),this._renderer.bindStops=Vy.bind(this),this._renderer.unbindStops=My.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let i=e.stops;i&&i.length>0&&(i=i.map(o=>o instanceof ci?o:new ci().copy(o)));const r=new ji(i).copy(e);return"id"in e&&(r.id=e.id),r}clone(e){const i=this.stops.map(o=>o.clone()),r=new ji(i);return oe.each(ji.Properties,o=>{r[o]=this[o]},this),e&&e.add(r),r}copy(e){super.copy.call(this,e);for(let i=0;i<ji.Properties.length;i++){const r=ji.Properties[i];r in e&&(this[r]=e[r])}return this}toObject(){const e={stops:this.stops.map(i=>i.toObject())};return oe.each(ji.Properties,i=>{e[i]=this[i]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(Ls,"Stop",ci),S(Ls,"Properties",["spread","stops","units"]);var ut=Ls,Fc={spread:{enumerable:!0,get:function(){return this._spread},set:function(n){this._spread=n,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(n){this._units=n,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(n){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._stops=new li((n||[]).slice(0)),this._stops.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._stops)}}};function Fy(){this._flagStops=!0}function Vy(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function My(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}var Hs=class to extends ut{constructor(e,i,r,o,s){super(s),S(this,"_flagEndPoints",!1),S(this,"_left",null),S(this,"_right",null);for(let a in Vc)Object.defineProperty(this,a,Vc[a]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Iy.bind(this),this.left=new re,this.right=new re,typeof e=="number"&&(this.left.x=e),typeof i=="number"&&(this.left.y=i),typeof r=="number"&&(this.right.x=r),typeof o=="number"&&(this.right.y=o)}static fromObject(e){const i=new to().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<to.Properties.length;i++){const r=to.Properties[i];r in e&&(this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new to(this.left._x,this.left._y,this.right._x,this.right._y,i);return oe.each(ut.Properties,function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};S(Hs,"Stop",ci),S(Hs,"Properties",["left","right"]);var Ge=Hs,Vc={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof re&&this._left.unbind(ee.Types.change,this._renderer.flagEndPoints),this._left=n,this._left.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(n){this._right instanceof re&&this._right.unbind(ee.Types.change,this._renderer.flagEndPoints),this._right=n,this._right.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function Iy(){this._flagEndPoints=!0}var Ws=class qi extends ut{constructor(e,i,r,o,s,a){super(o),S(this,"_flagRadius",!1),S(this,"_flagCenter",!1),S(this,"_flagFocal",!1),S(this,"_radius",0),S(this,"_center",null),S(this,"_focal",null);for(let l in Mc)Object.defineProperty(this,l,Mc[l]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Ay.bind(this),this._renderer.flagFocal=Oy.bind(this),this.center=new re,this.radius=typeof r=="number"?r:1,this.focal=new re,typeof e=="number"&&(this.center.x=e),typeof i=="number"&&(this.center.y=i),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof a=="number"&&(this.focal.y=a)}static fromObject(e){const i=new qi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<qi.Properties.length;i++){const r=qi.Properties[i];r in e&&(/(center|focal)i/.test(r)?this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]):typeof e[r]=="number"&&(this[r]=e[MediaKeySystemAccess]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new qi(this.center._x,this.center._y,this._radius,i,this.focal._x,this.focal._y);return oe.each(ut.Properties.concat(qi.Properties),function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return oe.each(qi.Properties,function(i){e[i]=this[i]},this),e.center=this.center.toObject(),e.focal=this.focal.toObject(),e}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};S(Ws,"Stop",ci),S(Ws,"Properties",["center","radius","focal"]);var Ze=Ws,Mc={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(n){this._center&&this._center.unbind(ee.Types.change,this._renderer.flagCenter),this._center=n,this._center.bind(ee.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(n){this._focal&&this._focal.unbind(ee.Types.change,this._renderer.flagFocal),this._focal=n,this._focal.bind(ee.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function Ay(){this._flagCenter=!0}function Oy(){this._flagFocal=!0}function Ic(n,e){if(e===0||e===1)return!0;const r=n._length*e;let o=0;for(let s=0;s<n._lengths.length;s++){const a=n._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function po(n,e){const i=n._length;if(e<=0)return 0;if(e>=i)return n._lengths.length-1;for(let r=0,o=0;r<n._lengths.length;r++){if(o+n._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/n._lengths[r];o+=n._lengths[r]}return-1}function Ac(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),kc(r,l,o,c,s,d,a,u,i)}function js(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),As(r,l,o,c,s,d,a,u,i)}function Ci(n){switch(n.renderer.type){case"texture":return ze.fromObject(n);case"gradient":return ut.fromObject(n);case"linear-gradient":return Ge.fromObject(n);case"radial-gradient":return Ze.fromObject(n)}return n}var zy=Math.cos,Dy=Math.sin,Oc=Math.tan,qs=[],zc=class nn extends ee{constructor(e,i,r,o,s,a){super(),S(this,"elements",new Cn(9)),S(this,"manual",!1);let l=e;Array.isArray(l)||(l=Array.prototype.slice.call(arguments)),this.identity(),l.length>0&&this.set(l)}static Multiply(e,i,r){if(i.length<=3){const B=e;let w,T,C;const $=i[0]||0,E=i[1]||0,I=i[2]||0;return w=B[0]*$+B[1]*E+B[2]*I,T=B[3]*$+B[4]*E+B[5]*I,C=B[6]*$+B[7]*E+B[8]*I,[w,T,C]}const o=e[0],s=e[1],a=e[2],l=e[3],c=e[4],d=e[5],u=e[6],f=e[7],h=e[8],p=i[0],m=i[1],g=i[2],b=i[3],y=i[4],_=i[5],k=i[6],x=i[7],v=i[8];return r=r||new Cn(9),r[0]=o*p+s*b+a*k,r[1]=o*m+s*y+a*x,r[2]=o*g+s*_+a*v,r[3]=l*p+c*b+d*k,r[4]=l*m+c*y+d*x,r[5]=l*g+c*_+d*v,r[6]=u*p+f*b+h*k,r[7]=u*m+f*y+h*x,r[8]=u*g+f*_+h*v,r}static fromObject(e){return new nn().copy(e)}set(e,i,r,o,s,a,l,c,d){if(typeof i>"u"){const u=e;e=u[0],i=u[1],r=u[2],o=u[3],s=u[4],a=u[5],l=u[6],c=u[7],d=u[8]}return this.elements[0]=e,this.elements[1]=i,this.elements[2]=r,this.elements[3]=o,this.elements[4]=s,this.elements[5]=a,this.elements[6]=l,this.elements[7]=c,this.elements[8]=d,this.trigger(ee.Types.change)}copy(e){return this.elements[0]=e.elements[0],this.elements[1]=e.elements[1],this.elements[2]=e.elements[2],this.elements[3]=e.elements[3],this.elements[4]=e.elements[4],this.elements[5]=e.elements[5],this.elements[6]=e.elements[6],this.elements[7]=e.elements[7],this.elements[8]=e.elements[8],this.manual=e.manual,this.trigger(ee.Types.change)}identity(){return this.elements[0]=nn.Identity[0],this.elements[1]=nn.Identity[1],this.elements[2]=nn.Identity[2],this.elements[3]=nn.Identity[3],this.elements[4]=nn.Identity[4],this.elements[5]=nn.Identity[5],this.elements[6]=nn.Identity[6],this.elements[7]=nn.Identity[7],this.elements[8]=nn.Identity[8],this.trigger(ee.Types.change)}multiply(e,i,r,o,s,a,l,c,d){if(typeof i>"u")return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(ee.Types.change);if(typeof r>"u"&&(r=1),typeof o>"u"){e=e||0,i=i||0,r=r||0,s=this.elements;const O=s[0]*e+s[1]*i+s[2]*r,U=s[3]*e+s[4]*i+s[5]*r,Q=s[6]*e+s[7]*i+s[8]*r;return[O,U,Q]}const u=this.elements,f=[e,i,r,o,s,a,l,c,d],h=u[0],p=u[1],m=u[2],g=u[3],b=u[4],y=u[5],_=u[6],k=u[7],x=u[8],v=f[0],B=f[1],w=f[2],T=f[3],C=f[4],$=f[5],E=f[6],I=f[7],R=f[8];return this.elements[0]=h*v+p*T+m*E,this.elements[1]=h*B+p*C+m*I,this.elements[2]=h*w+p*$+m*R,this.elements[3]=g*v+b*T+y*E,this.elements[4]=g*B+b*C+y*I,this.elements[5]=g*w+b*$+y*R,this.elements[6]=_*v+k*T+x*E,this.elements[7]=_*B+k*C+x*I,this.elements[8]=_*w+k*$+x*R,this.trigger(ee.Types.change)}inverse(e){const i=this.elements;e=e||new nn;const r=i[0],o=i[1],s=i[2],a=i[3],l=i[4],c=i[5],d=i[6],u=i[7],f=i[8],h=f*l-c*u,p=-f*a+c*d,m=u*a-l*d;let g=r*h+o*p+s*m;return g?(g=1/g,e.elements[0]=h*g,e.elements[1]=(-f*o+s*u)*g,e.elements[2]=(c*o-s*l)*g,e.elements[3]=p*g,e.elements[4]=(f*r-s*d)*g,e.elements[5]=(-c*r+s*a)*g,e.elements[6]=m*g,e.elements[7]=(-u*r+o*d)*g,e.elements[8]=(l*r-o*a)*g,e):null}scale(e,i){return arguments.length<=1&&(i=e),this.multiply(e,0,0,0,i,0,0,0,1)}rotate(e){const i=zy(e),r=Dy(e);return this.multiply(i,-r,0,r,i,0,0,0,1)}translate(e,i){return this.multiply(1,0,e,0,1,i,0,0,1)}skewX(e){const i=Oc(e);return this.multiply(1,i,0,0,1,0,0,0,1)}skewY(e){const i=Oc(e);return this.multiply(1,0,0,i,1,0,0,0,1)}toString(e){return qs.length=0,this.toTransformArray(e,qs),qs.map(Oe).join(" ")}toTransformArray(e,i){const r=this.elements,o=!!i,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],p=r[8];if(o){i[0]=s,i[1]=c,i[2]=f,i[3]=a,i[4]=d,i[5]=h,i[6]=l,i[7]=u,i[8]=p;return}return[s,c,f,a,d,h,l,u,p]}if(o){i[0]=s,i[1]=c,i[2]=a,i[3]=d,i[4]=l,i[5]=u;return}return[s,c,a,d,l,u]}toArray(e,i){const r=this.elements,o=!!i,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],p=r[8];if(o){i[0]=s,i[1]=a,i[2]=l,i[3]=c,i[4]=d,i[5]=u,i[6]=f,i[7]=h,i[8]=p;return}return[s,a,l,c,d,u,f,h,p]}if(o){i[0]=s,i[1]=a,i[2]=l,i[3]=c,i[4]=d,i[5]=u;return}return[s,a,l,c,d,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new nn().copy(this)}};S(zc,"Identity",[1,0,0,0,1,0,0,0,1]);var vi=zc;bc(vi);var Dc=class Al extends er{constructor(){super(),S(this,"_flagMatrix",!0),S(this,"_flagScale",!1),S(this,"_matrix",null),S(this,"_worldMatrix",null),S(this,"_position",null),S(this,"_rotation",0),S(this,"_scale",1),S(this,"_skewX",0),S(this,"_skewY",0);for(let e in go)Object.defineProperty(this,e,go[e]);this._renderer.flagMatrix=Lc.bind(this),this.isShape=!0,this.matrix=new vi,this.worldMatrix=new vi,this.position=new re,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const i=new Al().copy(e);return"id"in e&&(i.id=e.id),i}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return go.position.get.apply(this,arguments)}set translation(e){go.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&"visible"in this&&this.visible===!1||!s&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();return l?e>=l.left-a&&e<=l.right+a&&i>=l.top-a&&i<=l.bottom+a:!1}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof re?this.position=e.position:this.position.copy(e.position)),"rotation"in e&&(this.rotation=e.rotation),"scale"in e&&(this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re(e.scale.x,e.scale.y)),"skewX"in e&&(this.skewX=e.skewX),"skewY"in e&&(this.skewY=e.skewY),"matrix"in e&&e.matrix.manual&&(this.matrix.copy(e.matrix),this.matrix.manual=!0),this}clone(e){const i=new Al;return i.position.copy(this.position),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer={type:"shape"},e.isShape=!0,e.translation=this.translation.toObject(),e.rotation=this.translation.rotation,e.scale=this.scale instanceof re?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(e){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof re?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),e&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};S(Dc,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var Hn=Dc,go={position:{enumerable:!0,get:function(){return this._position},set:function(n){this._position&&this._position.unbind(ee.Types.change,this._renderer.flagMatrix),this._position=n,this._position.bind(ee.Types.change,this._renderer.flagMatrix),Lc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(n){this._rotation=n,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(n){this._skewX=n,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(n){this._skewY=n,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(n){this._matrix=n,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Ms(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function Lc(){this._flagMatrix=!0}var Hc=/^(?:none|transparent)$/i,Ly=8,Xs=Number.EPSILON;function Wn(n,e){return{x:n,y:e}}function yo(n,e,i=Xs){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function Wc(n,e,i,r){const o=n*i+e*r,s=Math.sqrt(n*n+e*e)*Math.sqrt(i*i+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return n*r-e*i<0&&(a=-a),a}function Hy(n,e,i){if(!n)return[Wn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Wn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=n.x,d=n.y,u=e.x,f=e.y,h=(c-u)/2,p=(d-f)/2,m=Math.cos(s),g=Math.sin(s);let b=m*h+g*p,y=-g*h+m*p,_=r*r,k=o*o;const x=b*b/_+y*y/k;if(x>1){const D=Math.sqrt(x);r*=D,o*=D,_=r*r,k=o*o}const v=_*y*y+k*b*b,B=v===0?0:(_*k-v)/v;let w=Math.sqrt(Math.max(0,B));a===l&&(w=-w);const T=w*r*y/o,C=-w*o*b/r,$=m*T-g*C+(c+u)/2,E=g*T+m*C+(d+f)/2,I=Wc(1,0,(b-T)/r,(y-C)/o),R=Wc((b-T)/r,(y-C)/o,(-b-T)/r,(-y-C)/o)%tt,O=I+R,U=l===0,Q=(()=>{const D=O-I,L=Math.abs(D)<Number.EPSILON;let z=st(D,tt);return z<Number.EPSILON&&(z=L?0:tt),U&&!L&&(z=z===tt?-tt:z-tt),z})(),G=Math.max(Ct.Resolution,Math.max(i*2,1)),W=[];for(let D=1;D<=G;D++){const L=D/G,z=I+L*Q;let P=$+r*Math.cos(z),q=E+o*Math.sin(z);if(s!==0){const K=P-$,J=q-E,Y=Math.cos(s),V=Math.sin(s);P=K*Y-J*V+$,q=K*V+J*Y+E}W.push(Wn(P,q))}return W}function Wy(n,e=Ly){const i=[],r=[],o=n._renderer&&n._renderer.vertices&&n._renderer.vertices.length>0?n._renderer.vertices:n.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(h=!1)=>{if(a){if(h&&l&&c&&!yo(l,c)){const p=Wn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&yo(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}yo(c,h)||(r.push({a:c,b:h}),a&&a.push(h),c=h)};for(let h=0;h<o.length;h++){const p=o[h],m=p.command||(h===0?ne.move:ne.line);if(m===ne.move){u(!1);const g=Wn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===ne.line)f(Wn(p.x,p.y));else if(m===ne.curve){const g=js(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(Wn(y.x,y.y))}f(Wn(p.x,p.y))}else if(m===ne.arc){const g=Hy(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===ne.close){u(!0),d=p;continue}else f(Wn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!yo(l,c);u(h)}return{polygons:i,segments:r}}function jy(n,e,i){let r=!1;for(let o=0;o<n.length;o++){const s=n[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function qy(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<Xs&&Math.abs(s)<Xs){const h=n-i.x,p=e-i.y;return h*h+p*p}const a=((n-i.x)*o+(e-i.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=i.x+l*o,d=i.y+l*s,u=n-c,f=e-d;return u*u+f*f}function Xy(n,e,i){if(!n||n.length===0)return 1/0;let r=1/0;for(let o=0;o<n.length;o++){const s=n[o],a=qy(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function Yy(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!Hc.test(i):!0}function Uy(n,e){const i=typeof n.linewidth=="number"?n.linewidth:n._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=n.stroke;return!r&&r!==0?!1:typeof r=="string"?!Hc.test(r):!0}function Ky(n,e,i,r=0){if(!n)return!1;const o=n.left-r,s=n.right+r,a=n.top-r,l=n.bottom+r;return e>=o&&e<=s&&i>=a&&i<=l}var bo=Number.EPSILON;function _o(n){return typeof n.relative!="boolean"||!!n.relative}function pn(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<bo&&Math.abs(r)<bo){_o(n)?o[e].clear():o[e].set(n.x,n.y);return}_o(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Wt(n,e){pn(n,e,0,0)}function Gy(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:_o(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function tr(n,e){const i=Gy(n,e);return Math.abs(i.x)>bo||Math.abs(i.y)>bo}function wo(n){n.command===ne.move||n.command===ne.close||(n.command=tr(n,"left")||tr(n,"right")?ne.curve:ne.line)}function jc(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function Zy(n,e){return tr(e,"right")||tr(n,"left")||tr(n,"right")||tr(e,"left")||n.command===ne.curve||e.command===ne.curve}function nr(n,e,i){return{x:Vt(n.x,e.x,i),y:Vt(n.y,e.y,i)}}function qc(n,e){const i=n.controls&&n.controls[e];return i?_o(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function Qy(n,e,i){const r=n.controls&&n.controls.right,o=e.controls&&e.controls.left,s={x:n.x,y:n.y},a=r?qc(n,"right"):Er({},s),l={x:e.x,y:e.y},c=o?qc(e,"left"):Er({},l),d=nr(s,a,i),u=nr(a,c,i),f=nr(c,l,i),h=nr(d,u,i),p=nr(u,f,i),m=nr(h,p,i),g=new Ee(m.x,m.y);return jc(g,n),pn(g,"left",h.x-m.x,h.y-m.y),pn(g,"right",p.x-m.x,p.y-m.y),g.command=ne.curve,{anchor:g,startOut:d,endIn:f}}function Jy(n,e,i,r,o,s){const a=n.length,l=i-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,a-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let w=0,T=e-u;w<=c;w+=1,T+=1){const C=st(T,a);h[w]=n[C]}let p=h[0].x+2*h[1].x,m=h[0].y+2*h[1].y,g=2;const b=c-1,y=[p],_=[m],k=[g],x=new Array(c+1),v=new Array(c+1);for(let w=1;w<c;w+=1){const T=w<b,C=T||s?1:2,$=T?4:s?2:7,E=T?4:s?3:8,I=T?2:s?0:1,R=C/g;g=k[w]=$-R,p=y[w]=E*h[w].x+I*h[w+1].x-R*p,m=_[w]=E*h[w].y+I*h[w+1].y-R*m}x[b]=y[b]/k[b],v[b]=_[b]/k[b];for(let w=c-2;w>=0;w-=1)x[w]=(y[w]-x[w+1])/k[w],v[w]=(_[w]-v[w+1])/k[w];x[c]=(3*h[c].x-x[b])/2,v[c]=(3*h[c].y-v[b])/2;const B=c-f;for(let w=u,T=e;w<=B;w+=1,T+=1){const C=st(T,a),$=n[C],E=x[w]-$.x,I=v[w]-$.y;o||w<B?pn($,"right",E,I):Wt($,"right"),o||w>u?pn($,"left",-E,-I):Wt($,"left"),wo($)}}function e0(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=re.distanceBetween(a,l),u=re.distanceBetween(l,c),f=r===void 0?.5:r,h=Math.pow(d,f),p=Math.pow(u,f),m=h*h,g=p*p;if(!o&&e){const b=2*g+3*p*h+m,y=3*p*(p+h);if(y!==0){const _=(g*a.x+b*l.x-m*c.x)/y-l.x,k=(g*a.y+b*l.y-m*c.y)/y-l.y;pn(n,"left",_,k)}else Wt(n,"left")}else Wt(n,"left");if(!s&&i){const b=2*m+3*h*p+g,y=3*h*(h+p);if(y!==0){const _=(m*c.x+b*l.x-g*a.x)/y-l.x,k=(m*c.y+b*l.y-g*a.y)/y-l.y;pn(n,"right",_,k)}else Wt(n,"right")}else Wt(n,"right");wo(n)}function t0(n,e,i,r,o,s){if(!(e&&i)){e||Wt(n,"left"),i||Wt(n,"right"),wo(n);return}const a=e,l=n,c=i,d=re.distanceBetween(a,l),u=re.distanceBetween(l,c),f=d+u,h=r===void 0?.4:r,p={x:a.x-c.x,y:a.y-c.y};if(!o&&f!==0){const m=h*d/f;pn(n,"left",p.x*m,p.y*m)}else Wt(n,"left");if(!s&&f!==0){const m=h*d/f-h;pn(n,"right",p.x*m,p.y*m)}else Wt(n,"right");wo(n)}function n0(n,e,i,r,o,s){const a=s.type,l=s.factor,c=n.length;for(let d=e;d<=i;d+=1){const u=st(d,c),f=n[u];if(f.command===ne.move){Wt(f,"left"),Wt(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[st(h,c)],g=p===null?null:n[st(p,c)],b=h===null,y=p===null;a==="geometric"?t0(f,m,g,l,b,y):e0(f,m,g,l,b,y)}}var ir=Math.min,rr=Math.max,i0=Math.ceil,r0=Math.floor,o0=new re,s0=new vi,Ys=class bi extends Hn{constructor(e,i,r,o){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagCap",!0),S(this,"_flagJoin",!0),S(this,"_flagMiter",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in Xc)Object.defineProperty(this,s,Xc[s]);this._renderer.type="path",this._renderer.flagVertices=Yc.bind(this),this._renderer.bindVertices=Uc.bind(this),this._renderer.unbindVertices=Kc.bind(this),this._renderer.flagFill=Gc.bind(this),this._renderer.flagStroke=Zc.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!i,this.curved=!!r,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=e,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Ci(e.fill),r=typeof e.stroke=="string"?e.stroke:Ci(e.stroke),o=new bi().copy(Vs(Er({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){if(super.copy.call(this,e),e.vertices){this.vertices=[];for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof Ee?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new Ee().copy(r))}}for(let i=0;i<bi.Properties.length;i++){const r=bi.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new bi;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<bi.Properties.length;r++){const o=bi.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(i=>i.toObject()),oe.each(bi.Properties,i=>{typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind(),i.controls&&(i.controls.left&&typeof i.controls.left.unbind=="function"&&i.controls.left.unbind(),i.controls.right&&typeof i.controls.right.unbind=="function"&&i.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),i=e.width/2,r=e.height/2,o=e.left+e.width/2,s=e.top+e.height/2;for(let a=0;a<this.vertices.length;a++){const l=this.vertices[a];l.x-=o,l.y-=s,l.x+=i,l.y+=r}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=i,this.mask.translation.y-=s,this.mask.translation.y+=r),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o];s.x-=i,s.y-=r}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getBoundingClientRect(e){let i,r,o,s,a,l,c=1/0,d=-1/0,u=1/0,f=-1/0;if(this._update(!0),i=e?this.matrix:this.worldMatrix,r=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:h,scaleY:p}=ki(i.elements[0],i.elements[3],i.elements[1],i.elements[4],i.elements[2],i.elements[5]);typeof h=="number"&&typeof p=="number"&&(r=Math.max(h,p)*(this.linewidth||0)/2)}else r*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(s=0;s<o;s++){l=this._renderer.vertices[s],a=this._renderer.vertices[(s+o-1)%o];const[h,p]=i.multiply(a.x,a.y),[m,g]=i.multiply(l.x,l.y);if(a.controls&&l.controls){let b=a.controls.right.x,y=a.controls.right.y;a.relative&&(b+=a.x,y+=a.y);let[_,k]=i.multiply(b,y),x=l.controls.left.x,v=l.controls.left.y;l.relative&&(x+=l.x,v+=l.y);let[B,w]=i.multiply(x,v);const T=Cc(h,p,_,k,B,w,m,g);u=ir(T.min.y-r,u),c=ir(T.min.x-r,c),d=rr(T.max.x+r,d),f=rr(T.max.y+r,f)}else s<=1&&(u=ir(p-r,u),c=ir(h-r,c),d=rr(h+r,d),f=rr(p+r,f)),u=ir(g-r,u),c=ir(m-r,c),d=rr(m+r,d),f=rr(g+r,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&this.visible===!1||!s&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();if(!l||e<l.left-a||e>l.right+a||i<l.top-a||i>l.bottom+a)return!1;const c=this.worldMatrix,d=c&&c.inverse(s0);if(!d)return super.contains(e,i,o);const[u,f]=d.multiply(e,i,1),h=typeof o.precision=="number"&&!Number.isNaN(o.precision)?Math.max(1,Math.floor(o.precision)):8,p=Yy(this,o.fill),m=Uy(this,o.stroke),{polygons:g,segments:b}=Wy(this,h);if(p&&g.length>0&&jy(g,u,f))return!0;if(m&&b.length>0){const y=typeof this.linewidth=="number"?this.linewidth:0;if(y>0&&Xy(b,u,f)<=y/2+a)return!0}return!p&&!m?super.contains(e,i,o):p&&g.length===0?super.contains(e,i,o):!1}getPointAt(e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_=this.length*Math.min(Math.max(e,0),1);const k=this.vertices.length,x=k-1;let v=null,B=null;for(let G=0,W=this._lengths.length,D=0;G<W;G++){if(D+this._lengths[G]>=_){this._closed?(r=st(G,k),o=st(G-1,k),G===0&&(r=o,o=G)):(r=G,o=Math.min(Math.max(G-1,0),x)),v=this.vertices[r],B=this.vertices[o],_-=D,this._lengths[G]!==0?e=_/this._lengths[G]:e=0;break}D+=this._lengths[G]}if(v===null||B===null)return null;if(v){if(!B)return v}else return B;y=B.controls&&B.controls.right,b=v.controls&&v.controls.left,l=B.x,h=B.y,c=(y||B).x,p=(y||B).y,d=(b||v).x,m=(b||v).y,u=v.x,g=v.y,y&&B.relative&&(c+=B.x,p+=B.y),b&&v.relative&&(d+=v.x,m+=v.y),a=Rr(e,l,c,d,u),f=Rr(e,h,p,m,g);const w=Vt(l,c,e),T=Vt(h,p,e),C=Vt(c,d,e),$=Vt(p,m,e),E=Vt(d,u,e),I=Vt(m,g,e),R=Vt(w,C,e),O=Vt(T,$,e),U=Vt(C,E,e),Q=Vt($,I,e);return oe.isObject(i)?(i.x=a,i.y=f,i instanceof Ee&&(i.controls.left.x=R,i.controls.left.y=O,i.controls.right.x=U,i.controls.right.y=Q,(typeof i.relative!="boolean"||i.relative)&&(i.controls.left.x-=a,i.controls.left.y-=f,i.controls.right.x-=a,i.controls.right.y-=f)),i.t=e,i):(s=new Ee(a,f,R-a,O-f,U-a,Q-f,this._curved?ne.curve:ne.line),s.t=e,s)}plot(){if(this.curved)return Sc(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ne.move:ne.line;return this}smooth(e){const i=e||{},r=i.type||"continuous",o=this._collection,s=o.length;if(s<2)return this;const a=this._closed||s>0&&o[s-1]&&o[s-1].command===ne.close,l=(h,p)=>{if(h==null)return p;if(typeof h=="number"){if(a)return st(h,s);let g=h;return g<0&&(g+=s),Math.min(Math.max(g,0),s-1)}const m=o.indexOf(h);return m!==-1?m:p},c=a&&i.from===void 0&&i.to===void 0;let d=l(i.from,0),u=l(i.to,s-1);if(d>u)if(a)d-=s;else{const h=d;d=u,u=h}const f=u-d+1;for(let h=0;h<f;h+=1){const p=st(d+h,s),m=o[p],g=!a&&p===0;m.command===ne.move&&!g&&(m.command=ne.line)}if(r==="continuous"||r==="asymmetric")Jy(o,d,u,a,c,r==="asymmetric");else if(r==="catmull-rom"||r==="geometric"){const h={type:r,factor:i.factor};n0(o,d,u,a,c,h)}else throw new Error(`Path.smooth does not support type "${r}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(e){this._update();const i=this.vertices,r=i.length;if(r<2)return this;const o=[];let s=null,a=null;for(let l=0;l<r;l+=1){const c=i[l];if(!s||c.command===ne.move){const u=c.clone();o.push(u),s=c,a=c;continue}if(Zy(c,s)){const f=js(c,s,e).length,h=o[o.length-1];let p=h.clone(),m=c.clone(),g=h,b=0;if(f<=1){const y=c.clone();o.push(y)}else{for(let _=1;_<f;_+=1){const k=_/f,x=1-b,v=x<=Number.EPSILON?k:(k-b)/x,B=Qy(p,m,v);pn(g,"right",B.startOut.x-g.x,B.startOut.y-g.y);const w=B.anchor;o.push(w),g=w,p=w.clone(),b=k,pn(m,"left",B.endIn.x-m.x,B.endIn.y-m.y)}const y=c.clone();y.controls.left.copy(m.controls.left),o.push(y)}}else{const u=js(c,s,e);for(let h=1;h<u.length;h+=1){const p=u[h];jc(p,s),Wt(p,"left"),Wt(p,"right"),p.command=ne.line,o.push(p)}const f=c.clone();o.push(f)}s=c,c.command===ne.close&&(s=a)}return this._automatic=!1,this._curved=!1,this.vertices=o,this}_updateLength(e,i){i||this._update();const o=this.vertices.length-1;let s=this.vertices[o],a=0;return typeof this._lengths>"u"&&(this._lengths=[]),oe.each(this.vertices,function(l,c){if(c<=0||l.command===ne.move){s=l,this._lengths[c]=0;return}this._lengths[c]=Ac(l,s,e),a+=this._lengths[c],s=l},this),this._length=a,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,i=this._closed,r=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),s=po(this,r*this._length),a=po(this,o*this._length),l=i0(s),c=r0(a);let d,u,f,h,p,m;for(this._renderer.vertices.length=0,m=0;m<e;m++)this._renderer.collection.length<=m&&this._renderer.collection.push(new Ee),m>c&&!u?(p=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(o,p),p.command=this._renderer.collection[m].command,this._renderer.vertices.push(p),u=p,f=this._collection[m-1],f&&f.controls&&(p.relative?p.controls.right.clear():p.controls.right.copy(p),f.relative?this._renderer.collection[m-1].controls.right.copy(f.controls.right).lerp(re.zero,1-p.t):this._renderer.collection[m-1].controls.right.copy(f.controls.right).lerp(f,1-p.t))):m>=l&&m<=c&&(p=this._renderer.collection[m].copy(this._collection[m]),this._renderer.vertices.push(p),m===c&&Ic(this,o)?(u=p,!i&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):m===l&&Ic(this,r)&&(d=p,d.command=ne.move,!i&&d.controls&&(d.relative?d.controls.left.clear():d.controls.left.copy(d))));l>0&&!d&&(m=l-1,p=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(r,p),p.command=ne.move,this._renderer.vertices.unshift(p),h=this._collection[m+1],h&&h.controls&&(p.controls.left.clear(),h.relative?this._renderer.collection[m+1].controls.left.copy(h.controls.left).lerp(re.zero,p.t):(o0.copy(h),this._renderer.collection[m+1].controls.left.copy(h.controls.left).lerp(h,p.t))))}return Hn.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,Hn.prototype.flagReset.call(this),this}};S(Ys,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),S(Ys,"Utils",{getCurveLength:Ac});var Pe=Ys,Xc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=!!n,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=!!n,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){if(n===this._automatic)return;this._automatic=!!n;const e=this._automatic?"ignore":"listen";oe.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),n instanceof li?this._collection=n:this._collection=new li(n||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,oe.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function Yc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Uc(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Kc(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Gc(){this._flagFill=!0}function Zc(){this._flagStroke=!0}var Qc=class no extends Pe{constructor(e,i,r,o){const s=[new Ee,new Ee,new Ee,new Ee];super(s,!0,!1,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_origin",null),this._renderer.type="rectangle";for(let a in Jc)Object.defineProperty(this,a,Jc[a]);this.width=typeof r=="number"?r:1,this.height=typeof o=="number"?o:1,this.origin=new re,typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i),this._update()}static fromObject(e){const i=new no().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<no.Properties.length;i++){const r=no.Properties[i];r in e&&(typeof e[r]=="number"?this[r]=e[r]:this[r]instanceof re&&this[r].copy(e[r]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,i=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ee),this.vertices[0].set(-e,-i).sub(this._origin).command=ne.move,this.vertices[1].set(e,-i).sub(this._origin).command=ne.line,this.vertices[2].set(e,i).sub(this._origin).command=ne.line,this.vertices[3].set(-e,i).sub(this._origin).command=ne.line,this.vertices[4]&&(this.vertices[4].set(-e,-i).sub(this._origin).command=ne.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=new no(0,0,this.width,this.height);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]instanceof re?i[o].copy(this[o]):i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="rectangle",e.width=this.width,e.height=this.height,e.origin=this.origin.toObject(),e}};S(Qc,"Properties",["width","height","origin"]);var di=Qc,Jc={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(n){this._origin&&this._origin.unbind(ee.Types.change,this._renderer.flagVertices),this._origin=n,this._origin.bind(ee.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},ed=class io extends di{constructor(e,i,r,o,s,a){super(i,r,0,0),S(this,"_flagTexture",!1),S(this,"_flagColumns",!1),S(this,"_flagRows",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_texture",null),S(this,"_columns",1),S(this,"_rows",1),S(this,"_frameRate",0),S(this,"_index",0),S(this,"_origin",null),this._renderer.type="sprite";for(let l in td)Object.defineProperty(this,l,td[l]);this.noStroke(),this.noFill(),e instanceof ze?this.texture=e:typeof e=="string"&&(this.texture=new ze(e)),this.origin=new re,this._update(),typeof o=="number"&&(this.columns=o),typeof s=="number"&&(this.rows=s),typeof a=="number"&&(this.frameRate=a),this.index=0}static fromObject(e){const i=new io().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<io.Properties.length;i++){const r=io.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(e){const i=new io(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&i.play(this._firstFrame,this._lastFrame),i.loop=this.loop,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="sprite",e.texture=this.texture.toObject(),e.columns=this.columns,e.rows=this.rows,e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture,i=this._columns,r=this._rows;let o,s,a,l,c,d,u,f,h;if(e&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=e),e.loaded)){u=e.image.width,f=e.image.height,o=u/i,s=f/r,l=this._amount,this.width!==o&&(this.width=o),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(oe.isNaN(this._lastFrame)&&(this._lastFrame=l-1),a=oe.performance.now()-this._startTime,h=this._lastFrame+1,c=1e3*(h-this._firstFrame)/this._frameRate,this._loop?a=a%c:a=Math.min(a,c),d=Vt(this._firstFrame,h,a/c),d=Math.floor(d),d!==this._index&&(this._index=d,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const p=this._index%i,m=Math.floor(this._index/i),g=-o*p+(u-o)/2,b=-s*m+(f-s)/2;g!==e.offset.x&&(e.offset.x=g),b!==e.offset.y&&(e.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(ed,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var xo=ed,td={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(n){this._columns=n,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(n){this._rows=n,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}},Us,nd=class extends li{constructor(e){e=Array.isArray(e)?e:Array.prototype.slice.call(arguments),super(e),mc(this,Us,{}),this.attach(e),this.on(ee.Types.insert,this.attach),this.on(ee.Types.remove,this.detach)}get ids(){return Lt(this,Us)}attach(e){for(let i=0;i<e.length;i++){const r=e[i];r&&r.id&&(this.ids[r.id]=r)}return this}detach(e){for(let i=0;i<e.length;i++)delete this.ids[e[i].id];return this}};Us=new WeakMap;var id=class Xi extends Pe{constructor(e,i,r,o,s,a,l){const c=l||Ct.Resolution*3,d=[];for(let u=0;u<c;u++)d.push(new Ee);super(d,!0,!1,!0),S(this,"_flagStartAngle",!1),S(this,"_flagEndAngle",!1),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_startAngle",0),S(this,"_endAngle",tt),S(this,"_innerRadius",0),S(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let u in rd)Object.defineProperty(this,u,rd[u]);typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.startAngle=s),typeof a=="number"&&(this.endAngle=a),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Xi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Xi.Properties.length;i++){const r=Xi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,i=this._endAngle,r=this._innerRadius,o=this._outerRadius,s=st(e,tt)===st(i,tt),a=r>0,l=this.vertices;let c=a?l.length/2:l.length,d,u=0,f,h,p,m,g,b,y,_,k;for(s?c--:a||(c-=2),f=0,h=c-1;f<c;f++){switch(p=f/h,m=l[u],g=p*(i-e)+e,b=(i-e)/c,y=o*Math.cos(g),_=o*Math.sin(g),f){case 0:d=ne.move;break;default:d=ne.curve}m.command=d,m.x=y,m.y=_,m.controls.left.clear(),m.controls.right.clear(),m.command===ne.curve&&(k=o*b/Math.PI,m.controls.left.x=k*Math.cos(g-dt),m.controls.left.y=k*Math.sin(g-dt),m.controls.right.x=k*Math.cos(g+dt),m.controls.right.y=k*Math.sin(g+dt),f===1&&m.controls.left.multiplyScalar(2),f===h&&m.controls.right.multiplyScalar(2)),u++}if(a){for(s?(l[u].command=ne.close,u++):(c--,h=c-1),f=0;f<c;f++)p=f/h,m=l[u],g=(1-p)*(i-e)+e,b=(i-e)/c,y=r*Math.cos(g),_=r*Math.sin(g),d=ne.curve,f<=0&&(d=s?ne.move:ne.line),m.command=d,m.x=y,m.y=_,m.controls.left.clear(),m.controls.right.clear(),m.command===ne.curve&&(k=r*b/Math.PI,m.controls.left.x=k*Math.cos(g+dt),m.controls.left.y=k*Math.sin(g+dt),m.controls.right.x=k*Math.cos(g-dt),m.controls.right.y=k*Math.sin(g-dt),f===1&&m.controls.left.multiplyScalar(2),f===h&&m.controls.right.multiplyScalar(2)),u++;l[u].copy(l[0]),l[u].command=ne.line}else s||(l[u].command=ne.line,l[u].x=0,l[u].y=0,u++,l[u].copy(l[0]),l[u].command=ne.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.startAngle,s=this.endAngle,a=this.vertices.length,l=new Xi(0,0,i,r,o,s,a);l.translation.copy(this.translation),l.rotation=this.rotation,l.scale=this.scale,l.skewX=this.skewX,l.skewY=this.skewY,this.matrix.manual&&l.matrix.copy(this.matrix);for(let c=0;c<Pe.Properties.length;c++){const d=Pe.Properties[c];l[d]=this[d]}return e&&e.add(l),l}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let i=0;i<Xi.Properties.length;i++){const r=Xi.Properties[i];e[r]=this[r]}return e}};S(id,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var Ks=id,rd={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(n){this._startAngle=n,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(n){this._endAngle=n,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}}},Gs=Math.cos,Zs=Math.sin,od=class Yi extends Pe{constructor(e,i,r,o){const s=o?Math.max(o,2):4,a=[];for(let l=0;l<s;l++)a.push(new Ee(0,0,0,0,0,0));super(a,!0,!0,!0),S(this,"_flagRadius",!1),S(this,"_radius",0),this._renderer.type="circle";for(let l in sd)Object.defineProperty(this,l,sd[l]);typeof r=="number"&&(this.radius=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Yi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Yi.Properties.length;i++){const r=Yi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(e*2)),r=this._radius,o=r*i;for(let s=0;s<this.vertices.length;s++){const l=s/e*tt,c=r*Gs(l),d=r*Zs(l),u=o*Gs(l-dt),f=o*Zs(l-dt),h=o*Gs(l+dt),p=o*Zs(l+dt),m=this.vertices[s];m.command=s===0?ne.move:ne.curve,m.set(c,d),m.controls.left.set(u,f),m.controls.right.set(h,p)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=new Yi(0,0,this.radius,this.vertices.length);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let i=0;i<Yi.Properties.length;i++){const r=Yi.Properties[i];e[r]=this[r]}return e}};S(od,"Properties",["radius"]);var ko=od,sd={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},Qs=Math.cos,Js=Math.sin,ad=class Ui extends Pe{constructor(e,i,r,o,s){typeof o!="number"&&typeof r=="number"&&(o=r);const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ee);super(l,!0,!0,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),this._renderer.type="ellipse";for(let c in ld)Object.defineProperty(this,c,ld[c]);typeof r=="number"&&(this.width=r*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Ui().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Ui.Properties.length;i++){const r=Ui.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(this.vertices.length*2)),r=this._width/2,o=this._height/2;for(let s=0;s<this.vertices.length;s++){const l=s/e*tt,c=r*Qs(l),d=o*Js(l),u=r*i*Qs(l-dt),f=o*i*Js(l-dt),h=r*i*Qs(l+dt),p=o*i*Js(l+dt),m=this.vertices[s];m.command=s===0?ne.move:ne.curve,m.set(c,d),m.controls.left.set(u,f),m.controls.right.set(h,p)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=this.width/2,r=this.height/2,o=this.vertices.length,s=new Ui(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let i=0;i<Ui.Properties.length;i++){const r=Ui.Properties[i];e[r]=this[r]}return e}};S(ad,"Properties",["width","height"]);var Co=ad,ld={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}}},a0=Math.ceil,l0=Math.floor,cd=class _i extends Hn{constructor(e){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagSize",!0),S(this,"_flagSizeAttenuation",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_size",1),S(this,"_sizeAttenuation",!1),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0),S(this,"noFill",Pe.prototype.noFill),S(this,"noStroke",Pe.prototype.noStroke),S(this,"corner",Pe.prototype.corner),S(this,"center",Pe.prototype.center),S(this,"getBoundingClientRect",Pe.prototype.getBoundingClientRect),S(this,"_updateLength",Pe.prototype._updateLength);for(let i in dd)Object.defineProperty(this,i,dd[i]);this._renderer.type="points",this._renderer.flagVertices=Yc.bind(this),this._renderer.bindVertices=Uc.bind(this),this._renderer.unbindVertices=Kc.bind(this),this._renderer.flagFill=Gc.bind(this),this._renderer.flagStroke=Zc.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=e,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Ci(e.fill),r=typeof e.stroke=="string"?e.stroke:Ci(e.stroke),o=new _i().copy(Vs(Er({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof Ee?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new Ee().copy(r))}for(let i=0;i<_i.Properties.length;i++){const r=_i.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new _i;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<_i.Properties.length;r++){const o=_i.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(i=>i.toObject()),oe.each(_i.Properties,function(i){typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(e){this._update();let i=[];for(let r=0;r<this.vertices.length;r++){const o=this.vertices[r],s=this.vertices[r-1];if(!s)continue;const a=o.x,l=o.y,c=s.x,d=s.y,u=As(a,l,a,l,c,d,c,d,e);i=i.concat(u)}return this.vertices=i,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),i=Math.max(this._beginning,this._ending),r=po(this,e*this._length),o=po(this,i*this._length),s=a0(r),a=l0(o);let l=0,c;this._renderer.vertices=[],this._renderer.collection=[];for(let d=0;d<this._collection.length;d++)d>=s&&d<=a&&(c=this._collection[d],this._renderer.collection.push(c),this._renderer.vertices[l*2+0]=c.x,this._renderer.vertices[l*2+1]=c.y,l++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};S(cd,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);var ea=cd,dd={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(n){this._sizeAttenuation=n,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),n instanceof li?this._collection=n:this._collection=new li(n||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}},c0=Math.cos,d0=Math.sin,ud=class Ki extends Pe{constructor(e,i,r,o){o=Math.max(o||0,3),super(),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagSides",!1),S(this,"_radius",0),S(this,"_width",0),S(this,"_height",0),S(this,"_sides",0),this._renderer.type="polygon";for(let s in fd)Object.defineProperty(this,s,fd[s]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.radius=r),typeof o=="number"&&(this.sides=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Ki().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Ki.Properties.length;i++){const r=Ki.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,a=tt*s+Math.PI/2,l=this._width*c0(a)/2,c=this._height*d0(a)/2;o>=r?this.vertices.push(new Ee(l,c)):this.vertices[o].set(l,c),this.vertices[o].command=o===0?ne.move:ne.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=new Ki(0,0,0,this.sides);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.width=this.width,i.height=this.height,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let i=0;i<Ki.Properties.length;i++){const r=Ki.Properties[i];e[r]=this[r]}return e}};S(ud,"Properties",["width","height","sides"]);var ta=ud,fd={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this.width=n*2,this.height=n*2}},width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},hd=class Gi extends Pe{constructor(e,i,r,o,s){typeof s>"u"&&typeof r=="number"&&typeof o=="number"&&(s=Math.floor(Math.min(r,o)/12));const a=[];for(let l=0;l<10;l++)a.push(new Ee(0,0,0,0,0,0,l===0?ne.move:ne.curve));super(a),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagRadius",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let l in md)Object.defineProperty(this,l,md[l]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=u0.bind(this),typeof r=="number"&&(this.width=r),typeof o=="number"&&(this.height=o),(typeof s=="number"||s instanceof re)&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Gi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Gi.Properties.length;i++){const r=Gi.Properties[i];if(r in e){const o=e[r];/radius/i.test(r)?this[r]=typeof o=="number"||o instanceof re?o:new re().copy(o):typeof o=="number"&&(this[r]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,i=this._height;let r,o;this._radius instanceof re?(r=this._radius.x,o=this._radius.y):(r=this._radius,o=this._radius);let s,a=e/2,l=i/2;s=this.vertices[0],s.x=-(a-r),s.y=-l,s=this.vertices[1],s.x=a-r,s.y=-l,s.controls.left.clear(),s.controls.right.x=r,s.controls.right.y=0,s=this.vertices[2],s.x=a,s.y=-(l-o),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=a,s.y=l-o,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=o,s=this.vertices[4],s.x=a-r,s.y=l,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(a-r),s.y=l,s.controls.left.clear(),s.controls.right.x=-r,s.controls.right.y=0,s=this.vertices[6],s.x=-a,s.y=l-o,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-a,s.y=-(l-o),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-o,s=this.vertices[8],s.x=-(a-r),s.y=-l,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[9],s.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=this.width,r=this.height,o=this.radius,s=new Gi(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let i=0;i<Gi.Properties.length;i++){const r=Gi.Properties[i];e[r]=this[r]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}};S(hd,"Properties",["width","height","radius"]);var vo=hd,md={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius instanceof re&&this._radius.unbind(ee.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof re&&this._radius.bind(ee.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function u0(){this._flagRadius=!0}var f0=Math.cos,h0=Math.sin,pd=class Zi extends Pe{constructor(e,i,r,o,s){arguments.length<=3&&(o=r,r=o/2),(typeof s!="number"||s<=0)&&(s=5),super(),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_flagSides",!1),S(this,"_innerRadius",0),S(this,"_outerRadius",0),S(this,"_sides",0),this._renderer.type="star";for(let a in gd)Object.defineProperty(this,a,gd[a]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Zi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Zi.Properties.length;i++){const r=Zi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,a=tt*s,l=(o%2?this._outerRadius:this._innerRadius)/2,c=l*f0(a),d=l*h0(a);o>=r?this.vertices.push(new Ee(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?ne.move:ne.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.sides,s=new Zi(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let i=0;i<Zi.Properties.length;i++){const r=Zi.Properties[i];e[r]=this[r]}return e}};S(pd,"Properties",["innerRadius","outerRadius","sides"]);var na=pd,gd={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},ia,yd=Math.min,bd=Math.max;Ke.document&&(ia=document.createElement("canvas"));var ra=class rn extends Hn{constructor(e,i,r,o){super(),S(this,"_flagValue",!0),S(this,"_flagFamily",!0),S(this,"_flagSize",!0),S(this,"_flagLeading",!0),S(this,"_flagAlignment",!0),S(this,"_flagBaseline",!0),S(this,"_flagStyle",!0),S(this,"_flagWeight",!0),S(this,"_flagDecoration",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_flagDirection",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_value",""),S(this,"_family","sans-serif"),S(this,"_size",13),S(this,"_leading",17),S(this,"_alignment","center"),S(this,"_baseline","middle"),S(this,"_style","normal"),S(this,"_weight",500),S(this,"_decoration","none"),S(this,"_direction","ltr"),S(this,"_fill","#000"),S(this,"_stroke","none"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in _d)Object.defineProperty(this,s,_d[s]);if(this._renderer.type="text",this._renderer.flagFill=m0.bind(this),this._renderer.flagStroke=p0.bind(this),this.value=e,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this.dashes=[],this.dashes.offset=0,!oe.isObject(o))return this;for(let s=0;s<rn.Properties.length;s++){const a=rn.Properties[s];a in o&&(this[a]=o[a])}}static Measure(e){if(ia){const i=ia.getContext("2d");i.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const r=i.measureText(e.value,0,0),o=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent;return{width:r.width,height:o}}else{const i=this.value.length*this.size*rn.Ratio,r=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:i,height:r}}}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Ci(e.fill),r=typeof e.stroke=="string"?e.stroke:Ci(e.stroke),o=new rn().copy(Vs(Er({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<rn.Properties.length;i++){const r=rn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new rn(this.value);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale;for(let r=0;r<rn.Properties.length;r++){const o=rn.Properties[r];i[o]=this[o]}return this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let i=0;i<rn.Properties.length;i++){const r=rn.Properties[i];e[r]=this[r]}return e}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let i,r,o,s,a;this._update(!0),i=e?this.matrix:this.worldMatrix;const{width:l,height:c}=rn.Measure(this),d=(this._linewidth||0)/2;switch(this.alignment){case"left":r=-d,o=l+d;break;case"right":r=-(l+d),o=d;break;default:r=-(l/2+d),o=l/2+d}switch(this.baseline){case"middle":s=-(c/2+d),a=c/2+d;break;default:s=-(c+d),a=d}const[u,f]=i.multiply(r,s),[h,p]=i.multiply(r,a),[m,g]=i.multiply(o,s),[b,y]=i.multiply(o,a);return s=yd(f,p,g,y),r=yd(u,h,m,b),o=bd(u,h,m,b),a=bd(f,p,g,y),{top:s,left:r,right:o,bottom:a,width:o-r,height:a-s}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};S(ra,"Ratio",.6),S(ra,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);var Sn=ra,_d={value:{enumerable:!0,get:function(){return this._value},set:function(n){this._value=n,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(n){this._family=n,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(n){this._leading=n,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(n){this._alignment=n,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(n){this._style=n,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(n){this._weight=n,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(n){this._decoration=n,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(n){this._direction=n,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(n){this._baseline=n,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ge||this._fill instanceof Ze||this._fill instanceof ze)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ge||this._stroke instanceof Ze||this._stroke instanceof ze)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,oe.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function m0(){this._flagFill=!0}function p0(){this._flagStroke=!0}var oa=class wr extends di{constructor(e,i,r,o){super(i,r,0,0),S(this,"_flagTextures",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_index",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_textures",null),S(this,"_frameRate",0),S(this,"_origin",null),this._renderer.type="image-sequence";for(let s in wd)Object.defineProperty(this,s,wd[s]);this._renderer.flagTextures=g0.bind(this),this._renderer.bindTextures=y0.bind(this),this._renderer.unbindTextures=b0.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(xd.bind(this)):typeof e=="string"&&(this.textures=[xd(e)]),this.origin=new re,this._update(),typeof o=="number"?this.frameRate=o:this.frameRate=wr.DefaultFrameRate,this.index=0}static fromObject(e){const i=new wr().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<wr.Properties.length;i++){const r=wr.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(e){const i=new wr(this.textures,this.translation.x,this.translation.y,this.frameRate);return i._loop=this._loop,this._playing&&i.play(),e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image-sequence",e.textures=this.textures.map(function(i){return i.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let e=0;e<this.textures.length;e++){const i=this.textures[e];typeof i.dispose=="function"?i.dispose():typeof i.unbind=="function"&&i.unbind()}return this}_update(){const e=this._textures;let i,r,o,s,a,l,c,d;return e&&(this._flagTextures&&(this._amount=e.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(s=this._amount,oe.isNaN(this._lastFrame)&&(this._lastFrame=s-1),o=oe.performance.now()-this._startTime,d=this._lastFrame+1,a=1e3*(d-this._firstFrame)/this._frameRate,this._loop?o=o%a:o=Math.min(o,a),c=Vt(this._firstFrame,d,o/a),c=Math.floor(c),c!==this._index&&(this._index=c,l=e[this._index],l.loaded&&(i=l.image.width,r=l.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r),this.fill=l,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof ze))&&(l=e[this._index],l.loaded&&(i=l.image.width,r=l.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r)),this.fill=l)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(oa,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),S(oa,"DefaultFrameRate",30);var sa=oa,wd={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(n){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._textures=new li((n||[]).slice(0)),this._textures.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}};function g0(){this._flagTextures=!0}function y0(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function b0(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function xd(n){if(n instanceof ze)return n;if(typeof n=="string")return new ze(n)}var So=Math.min,Bo=Math.max,_0={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},aa=class un extends Hn{constructor(e){super(),S(this,"_flagAdditions",!1),S(this,"_flagSubtractions",!1),S(this,"_flagOrder",!1),S(this,"_flagOpacity",!0),S(this,"_flagBeginning",!1),S(this,"_flagEnding",!1),S(this,"_flagLength",!1),S(this,"_flagMask",!1),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_length",0),S(this,"_mask",null),S(this,"_strokeAttenuation",!0);for(let i in kd)Object.defineProperty(this,i,kd[i]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let i=0;i<e.length;i++)Cd.call(this,e[i],this)}static RemoveChildren(e){for(let i=0;i<e.length;i++)Cd.call(this,e[i])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const i=new un;for(let o=0;o<un.Properties.length;o++){const s=un.Properties[o];s in e&&(/(fill|stroke)/i.test(s)?i[s]=typeof e[s]=="string"?e[s]:Ci(e[s]):i[s]=e[s])}return"mask"in e&&(i.mask=r(e.mask)),"id"in e&&(i.id=e.id),i.children=e.children.map(r),i;function r(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return Ks.fromObject(o);case"circle":return ko.fromObject(o);case"element":return er.fromObject(o);case"ellipse":return Co.fromObject(o);case"group":return un.fromObject(o);case"image":return Image.fromObject(o);case"image-sequence":return sa.fromObject(o);case"path":return Pe.fromObject(o);case"points":return ea.fromObject(o);case"polygon":return ta.fromObject(o);case"rectangle":return di.fromObject(o);case"rounded-rectangle":return vo.fromObject(o);case"shape":return Hn.fromObject(o);case"sprite":return xo.fromObject(o);case"star":return na.fromObject(o);case"text":return Sn.fromObject(o)}return o}}static IsVisible(e,i){if(!i)return!0;let r=e;for(;r;){if(typeof r.visible=="boolean"&&!r.visible||typeof r.opacity=="number"&&r.opacity<=0)return!1;r=r.parent}return!0}static VisitForHitTest(e,i,r,o,s,a,l){const c=e&&e.children;if(!c)return!1;const d=i.results;for(let u=c.length-1;u>=0;u--){const f=c[u];if(!f||!un.IsVisible(f,i.visibleOnly))continue;const h=typeof f.getBoundingClientRect=="function"?f.getBoundingClientRect():null;if(!(h&&!Ky(h,i.x,i.y,a))){if(f instanceof un){if(r&&(!o||o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),l)||un.VisitForHitTest(f,i,r,o,s,a,l))return!0;continue}if(f instanceof Hn&&!(o&&!o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),l))return!0}}return!1}copy(e){super.copy.call(this,e),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let i=0;i<un.Properties.length;i++){const r=un.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new un,r=this.children.map(function(o){return o.clone()});return i.add(r),i.opacity=this.opacity,this.mask&&(i.mask=this.mask),i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.className=this.className,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="group",e.children=[],e.opacity=this.opacity,e.className=this.className,e.mask=this.mask?this.mask.toObject():null,oe.each(this.children,(i,r)=>{e.children[r]=i.toObject()},this),e}dispose(){if(super.dispose(),this.children)for(let e=0;e<this.children.length;e++){const i=this.children[e];typeof i.dispose=="function"&&i.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(e,i,r){const o=r||{},{results:s,hitOptions:a,context:l,single:c,empty:d}=_0.getShapesAtPoint;s.length=0;const u=o.mode==="deepest"||o.deepest?"deepest":"all",f=o.visibleOnly!==!1,h=!!o.includeGroups,p=typeof o.filter=="function"?o.filter:null,m=typeof o.tolerance=="number"?o.tolerance:0;typeof o.precision=="number"?a.precision=o.precision:delete a.precision,typeof o.fill<"u"?a.fill=o.fill:delete a.fill,typeof o.stroke<"u"?a.stroke=o.stroke:delete a.stroke,a.tolerance=m,a.ignoreVisibility=!f;const g=u==="deepest";if(l.x=e,l.y=i,l.visibleOnly=f,l.results=s,un.VisitForHitTest(this,l,h,p,a,m,g),g){if(s.length>0){const y=s[0];return s.length=0,c[0]=y,c.length=1,c}return d.length=0,d}const b=s.slice();return s.length=0,b}corner(){const e=this.getBoundingClientRect(!0);for(let i=0;i<this.children.length;i++){const r=this.children[i];r.translation.x-=e.left,r.translation.y-=e.top}return this.mask&&(this.mask.translation.x-=e.left,this.mask.translation.y-=e.top),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const s=this.children[o];s.isShape&&(s.translation.x-=i,s.translation.y-=r)}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getById(e){let i=null;function r(o){if(o.id===e)return o;if(o.children){if(o.children.ids[e])return o.children.ids[e];for(let s=0;s<o.children.length;s++)if(i=r(o.children[s]),i)return i}return null}return r(this)}getByClassName(e){const i=[];function r(o){if(Array.prototype.indexOf.call(o.classList,e)>=0&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return i}return r(this)}getByType(e){const i=[];function r(o){if(o instanceof e&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return i}return r(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let i=0;i<e.length;i++){const r=e[i];if(!(r&&r.id))continue;const o=Array.prototype.indexOf.call(this.children,r);o>=0&&this.children.splice(o,1),this.children.push(r)}return this}remove(e){const i=arguments.length,r=this.parent;if(i<=0&&r)return r.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let o=0;o<e.length;o++){const s=e[o];if(!s||!this.children.ids[s.id])continue;const a=this.children.indexOf(s);a>=0&&this.children.splice(a,1)}return this}getBoundingClientRect(e){let i,r,o,s,a,l;this._update(!0);let c=1/0,d=-1/0,u=1/0,f=-1/0;const h=/texture|gradient/i;r=e?this.matrix:this.worldMatrix;for(let p=0;p<this.children.length;p++){const m=this.children[p];if(!(!m.visible||h.test(m._renderer.type))&&(i=m.getBoundingClientRect(e),o=typeof i.top!="number"||oe.isNaN(i.top)||!isFinite(i.top),s=typeof i.left!="number"||oe.isNaN(i.left)||!isFinite(i.left),a=typeof i.right!="number"||oe.isNaN(i.right)||!isFinite(i.right),l=typeof i.bottom!="number"||oe.isNaN(i.bottom)||!isFinite(i.bottom),!(o||s||a||l)))if(e){const[g,b]=r.multiply(i.left,i.top),[y,_]=r.multiply(i.right,i.top),[k,x]=r.multiply(i.left,i.bottom),[v,B]=r.multiply(i.right,i.bottom);u=So(b,_,x,B,u),c=So(g,y,k,v,c),d=Bo(g,y,k,v,d),f=Bo(b,_,x,B,f)}else u=So(i.top,u),c=So(i.left,c),d=Bo(i.right,d),f=Bo(i.bottom,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}noFill(){return this.children.forEach(function(e){e.noFill()}),this}noStroke(){return this.children.forEach(function(e){e.noStroke()}),this}subdivide(){const e=arguments;return this.children.forEach(function(i){i.subdivide.apply(i,e)}),this}_update(){let e,i,r;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=this.length;let l=0;const c=o*a,d=s*a;for(e=0;e<this.children.length;e++)r=this.children[e],i=r.length,c>l+i?(r.beginning=1,r.ending=1):d<l?(r.beginning=0,r.ending=0):c>l&&c<l+i?(r.beginning=(c-l)/i,r.ending=1):d>l&&d<l+i?(r.beginning=0,r.ending=(d-l)/i):(r.beginning=0,r.ending=1),l+=i}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};S(aa,"Children",nd),S(aa,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var yt=aa,kd={visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._flagVisible=this._visible!==n||this._flagVisible,this._visible=n}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._flagOpacity=this._opacity!==n||this._flagOpacity,this._opacity=n}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._flagBeginning=this._beginning!==n||this._flagBeginning,this._beginning=n}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._flagEnding=this._ending!==n||this._flagEnding,this._ending=n}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let n=0;n<this.children.length;n++){const e=this.children[n];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){this._fill=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=n}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){this._stroke=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=n}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=n}}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=n}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=n}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=n}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=n}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=n}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){this._automatic=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=n}}},children:{enumerable:!0,get:function(){return this._children},set:function(n){const e=yt.InsertChildren.bind(this),i=yt.RemoveChildren.bind(this),r=yt.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new nd(n),this._children.bind(ee.Types.insert,e),this._children.bind(ee.Types.remove,i),this._children.bind(ee.Types.order,r),n.length>0&&e(n)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,oe.isObject(n)&&!n.clip&&(n.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=n)}}}};function Cd(n,e){const i=n.parent;let r;if(i===e){o();return}if(i&&i.children.ids[n.id]&&(r=Array.prototype.indexOf.call(i.children,n),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete n.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,n),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,n),r>=0&&e.additions.splice(r,1)),n.parent=e,e.additions.push(n),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,n),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,n),r<0&&(i.subtractions.push(n),i._flagSubtractions=!0)}}var No=class extends Pe{constructor(e,i,r,o){const s=[new Ee(e,i),new Ee(r,o)];super(s);for(let a in vd)Object.defineProperty(this,a,vd[a]);this.vertices[0].command=ne.move,this.vertices[1].command=ne.line,this.automatic=!1}};S(No,"Properties",["left","right"]);var vd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(oe.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=ne.move;else{const e=new Ht("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(n){if(oe.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=ne.line;else{const e=new Ht("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}},Bn={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},w0={start:"left",middle:"center",end:"right"},Sd=["id","class","transform","xmlns","viewBox"],x0=["x","y","width","height","href","xlink:href"];function k0(n){return w0[n]}function C0(n){const e=n.getAttribute("dominant-baseline"),i=n.getAttribute("alignment-baseline");return e||i}function Pr(n){return n.replace(/svg:/gi,"").toLowerCase()}function Bd(n,e){if(e.x+=n.translateX,e.y+=n.translateY,e.x*=n.scaleX,e.y*=n.scaleY,n.rotation!==0){const i=e.length();e.x=i*Math.cos(n.rotation),e.y=i*Math.sin(n.rotation)}}function v0(n,e){e||(e={});const i=n.split(";");for(let r=0;r<i.length;r++){const o=i[r].split(":"),s=o[0],a=o[1];if(typeof s>"u"||typeof a>"u")continue;const l=s.replace(/\s/g,""),c=a.replace(/\s/g,"");e[l]=c}return e}function S0(n){const e={},i=B0(n),r=Math.max(i.length,n.style.length);for(let o=0;o<r;o++){const s=n.style[o],a=i[o];s&&(e[s]=n.style[s]),a&&(e[a]=n.getAttribute(a))}return e}function B0(n){const e=n.getAttributeNames();for(let i=0;i<Sd.length;i++){const r=Sd[i],o=Array.prototype.indexOf.call(e,r);o>=0&&e.splice(o,1)}return e}function N0(n,e){const i=e.split(/[\s,]/),r=-parseFloat(i[0]),o=-parseFloat(i[1]),s=parseFloat(i[2]),a=parseFloat(i[3]);if(r&&o)for(let f=0;f<n.children.length;f++){const h=n.children[f];"translation"in h?h.translation.add(r,o):"x"in h?h.x=r:"y"in h&&(h.y=o)}const l=typeof n.x=="number",c=typeof n.y=="number",d=typeof n.width=="number",u=typeof n.height=="number";return l&&(n.translation.x+=n.x),c&&(n.translation.y+=n.y),(d||u)&&(n.scale=new re(1,1)),d&&(n.scale.x=n.width/s),u&&(n.scale.y=n.height/a),n.mask=new di(0,0,s,a),n.mask.origin.set(-s/2,-a/2),n}function on(n,e,i){const r={},o={},s={};let a,l,c,d,u,f,h,p,m,g,b,y,_,k,x,v,B;if(n===null)return r;if(Ke.getComputedStyle){const w=Ke.getComputedStyle(n);for(a=w.length;a--;)c=w[a],d=w[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<n.attributes.length;a++)f=n.attributes[a],/style/i.test(f.nodeName)?v0(f.value,s):o[f.nodeName]=f.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),i&&oe.defaults(r,i),oe.extend(r,s,o),r.visible=!(typeof r.display>"u"&&/none/i.test(r.display))||typeof r.visibility>"u"&&/hidden/i.test(r.visibility);for(c in r)switch(d=r[c],c){case"gradientTransform":if(/none/i.test(d)||(l=n.gradientTransform&&n.gradientTransform.baseVal&&n.gradientTransform.baseVal.length>0?n.gradientTransform.baseVal[0].matrix:n.getCTM?n.getCTM():null,l===null))break;switch(h=ki(l),e._renderer.type){case"linear-gradient":Bd(h,e.left),Bd(h,e.right);break;case"radial-gradient":e.center.x+=h.translateX,e.center.y+=h.translateY,e.focal.x+=h.translateX,e.focal.y+=h.translateY,e.radius*=Math.max(h.scaleX,h.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=n.transform&&n.transform.baseVal&&n.transform.baseVal.length>0?n.transform.baseVal[0].matrix:n.getCTM?n.getCTM():null,l===null))break;h=ki(l),e.translation.set(h.translateX,h.translateY),e.rotation=Math.PI*(h.rotation/180),e.scale=new re(h.scaleX,h.scaleY),p=parseFloat((r.x+"").replace("px")),m=parseFloat((r.y+"").replace("px")),p&&(e.translation.x=p),m&&(e.translation.y=m);break;case"visible":if(e instanceof yt){e._visible=d;break}e.visible=d;break;case"stroke-linecap":if(e instanceof yt){e._cap=d;break}e.cap=d;break;case"stroke-linejoin":if(e instanceof yt){e._join=d;break}e.join=d;break;case"stroke-miterlimit":if(e instanceof yt){e._miter=d;break}e.miter=d;break;case"stroke-width":if(e instanceof yt){e._linewidth=parseFloat(d);break}e.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(e instanceof yt){e._opacity=parseFloat(d);break}e.opacity=parseFloat(d);break;case"clip-path":if(Bn.cssBackgroundImage.test(d)&&(g=d.replace(Bn.cssBackgroundImage,"$1"),Ue.defs.current&&Ue.defs.current.contains(g)&&(y=Ue.defs.current.get(g),y&&y.childNodes.length>0)))switch(y=y.childNodes[0],_=Pr(y.nodeName),e.mask=Ue[_].call(this,y,{}),e._renderer.type){case"text":case"path":e.position.add(e.mask.position),e.mask.position.clear();break}break;case"fill":case"stroke":u=(e instanceof yt?"_":"")+c,Bn.cssBackgroundImage.test(d)?(g=d.replace(Bn.cssBackgroundImage,"$1"),Ue.defs.current&&Ue.defs.current.contains(g)?(y=Ue.defs.current.get(g),y.object||(_=Pr(y.nodeName),y.object=Ue[_].call(this,y,{})),y=y.object):(b=$0(this),y=b.getById(g)),e[u]=y):e[u]=d;break;case"id":e.id=d;break;case"class":case"className":e.classList=d.split(" "),e._flagClassName=!0;break;case"x":case"y":if(k=e instanceof ut,x=e instanceof Ge,v=e instanceof Ze,k||x||v)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Ht("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),e.translation[c]=parseFloat(d);break;case"font-family":e instanceof Sn&&(e.family=d);break;case"font-size":e instanceof Sn&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Ht("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),e.size=parseFloat(d));break;case"font-weight":e instanceof Sn&&(e.weight=d);break;case"font-style":e instanceof Sn&&(e.style=d);break;case"text-decoration":e instanceof Sn&&(e.decoration=d);break;case"line-height":e instanceof Sn&&(e.leading=d);break}return Object.keys(n.dataset).length&&(e.dataset=n.dataset),r}function T0(n,e){for(let i=0,r=n.childNodes.length;i<r;i++){const o=n.childNodes[i];!o.id||Pr(n.nodeName)==="#text"||e.add(o.id,o)}}function $0(n){for(;n.parent;)n=n.parent;return n.scene}var Ue={svg:function(n){const e=Ue.defs.current=new ho,i=n.getElementsByTagName("defs");for(let m=0;m<i.length;m++)T0(i[m],e);const r=Ue.g.call(this,n),o=n.getAttribute("viewBox"),s=n.getAttribute("x"),a=n.getAttribute("y"),l=n.getAttribute("width"),c=n.getAttribute("height");r.defs=e;const d=o!==null,u=s!==null,f=a!==null,h=l!==null,p=c!==null;return u&&(r.x=parseFloat(s.replace(Bn.unitSuffix,""))),f&&(r.y=parseFloat(a.replace(Bn.unitSuffix,""))),h&&(r.width=parseFloat(l.replace(Bn.unitSuffix,""))),p&&(r.height=parseFloat(c.replace(Bn.unitSuffix,""))),d&&N0(r,o),delete Ue.defs.current,r},defs:function(n){return null},use:function(n,e){let i;const r=n.getAttribute("href")||n.getAttribute("xlink:href");if(!r)return i=new Ht("encountered <use /> with no href."),console.warn(i.name,i.message),null;const o=r.slice(1);if(!Ue.defs.current.contains(o))return i=new Ht("unable to find element for reference "+r+"."),console.warn(i.name,i.message),null;const a=Ue.defs.current.get(o).cloneNode(!0);for(let c=0;c<n.attributes.length;c++){const d=n.attributes[c],u=x0.includes(d.nodeName),f=!a.hasAttribute(d.nodeName);(u||f)&&a.setAttribute(d.nodeName,d.value)}const l=Pr(a.nodeName);return Ue[l].call(this,a,e)},g:function(n,e){const i=new yt;on.call(this,n,i,e),this.add(i);const r=S0.call(this,n);for(let o=0,s=n.childNodes.length;o<s;o++){const a=n.childNodes[o],l=a.nodeName;if(!l)return;const c=Pr(l);if(c in Ue){const d=Ue[c].call(i,a,r);d&&!d.parent&&i.add(d)}}return i},polygon:function(n,e){let i;typeof n=="string"?i=n:i=n.getAttribute("points");const r=[];i.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(s,a,l){r.push(new Ee(parseFloat(a),parseFloat(l)))});const o=new Pe(r,!0);return o.stroke="none",o.fill="black",on.call(this,n,o,e),o},polyline:function(n,e){const i=Ue.polygon.call(this,n,e);return i.closed=!1,i},path:function(n,e){let i;typeof n=="string"?(i=n,n=null):i=n.getAttribute("d");let r=[],o=!1,s=!1;if(i){let l=new Ee,c,d,u=i.match(/[a-df-z][^a-df-z]*/gi);const f=u.length-1;oe.each(u.slice(0),function(h,p){const m=h.slice(1).trim().match(Bn.path),g=h[0],b=g.toLowerCase();let y,_,k,x,v;const B=[];switch(p===0&&(u=[]),b){case"h":case"v":m.length>1&&(y=1);break;case"m":case"l":case"t":m.length>2&&(y=2);break;case"s":case"q":m.length>4&&(y=4);break;case"c":m.length>6&&(y=6);break;case"a":m.length>7&&(y=7);break}if(y){for(_=0,k=m.length,v=0;_<k;_+=y){if(x=g,v>0)switch(g){case"m":x="l";break;case"M":x="L";break}B.push(x+m.slice(_,_+y).join(" ")),v++}u=Array.prototype.concat.apply(u,B)}else u.push(h)}),oe.each(u,function(h,p){let m,g,b;const y=h[0],_=y.toLowerCase();d=h.slice(1).trim().match(Bn.path),s=y===_;let k,x,v,B,w,T,C,$,E,I,R,O,U,Q,G,W,D;switch(_){case"z":if(p>=f)o=!0;else{g=l.x,b=l.y,m=new Ee(g,b,void 0,void 0,void 0,void 0,ne.close);for(let L=r.length-1;L>=0;L--){const z=r[L];if(/m/i.test(z.command)){l=z;break}}}break;case"m":case"l":c=void 0,g=parseFloat(d[0]),b=parseFloat(d[1]),m=new Ee(g,b,void 0,void 0,void 0,void 0,/m/i.test(_)?ne.move:ne.line),s&&m.addSelf(l),l=m;break;case"h":case"v":I=/h/i.test(_)?"x":"y",R=/x/i.test(I)?"y":"x",m=new Ee(void 0,void 0,void 0,void 0,void 0,void 0,ne.line),m[I]=parseFloat(d[0]),m[R]=l[R],s&&(m[I]+=l[I]),l=m;break;case"c":case"s":k=l.x,x=l.y,c||(c=new re),/c/i.test(_)?(v=parseFloat(d[0]),B=parseFloat(d[1]),w=parseFloat(d[2]),T=parseFloat(d[3]),C=parseFloat(d[4]),$=parseFloat(d[5])):(E=Os(l,c,s),v=E.x,B=E.y,w=parseFloat(d[0]),T=parseFloat(d[1]),C=parseFloat(d[2]),$=parseFloat(d[3])),s&&(v+=k,B+=x,w+=k,T+=x,C+=k,$+=x),l.controls.right.set(v-l.x,B-l.y),m=new Ee(C,$,w-C,T-$,void 0,void 0,ne.curve),l=m,c=m.controls.left;break;case"t":case"q":k=l.x,x=l.y,c||(c=new re),/q/i.test(_)?(v=parseFloat(d[0]),B=parseFloat(d[1]),w=parseFloat(d[0]),T=parseFloat(d[1]),C=parseFloat(d[2]),$=parseFloat(d[3])):(E=Os(l,c,s),v=E.x,B=E.y,w=E.x,T=E.y,C=parseFloat(d[0]),$=parseFloat(d[1])),s&&(v+=k,B+=x,w+=k,T+=x,C+=k,$+=x),l.controls.right.set((v-l.x)*.33,(B-l.y)*.33),m=new Ee(C,$,w-C,T-$,void 0,void 0,ne.curve),l=m,c=m.controls.left;break;case"a":k=l.x,x=l.y,U=parseFloat(d[0]),Q=parseFloat(d[1]),G=parseFloat(d[2]),W=parseFloat(d[3]),D=parseFloat(d[4]),C=parseFloat(d[5]),$=parseFloat(d[6]),s&&(C+=k,$+=x),O=new Ee(C,$),O.command=ne.arc,O.rx=U,O.ry=Q,O.xAxisRotation=G,O.largeArcFlag=W,O.sweepFlag=D,m=O,l=O,c=void 0;break}m&&(Array.isArray(m)?r=r.concat(m):r.push(m))})}i=new Pe(r,o,void 0,!0),i.stroke="none",i.fill="black";const a=i.getBoundingClientRect(!0);return a.centroid={x:a.left+a.width/2,y:a.top+a.height/2},oe.each(i.vertices,function(l){l.subSelf(a.centroid)}),on.call(this,n,i,e),i.translation.addSelf(a.centroid),i},circle:function(n,e){const i=parseFloat(n.getAttribute("cx")),r=parseFloat(n.getAttribute("cy")),o=parseFloat(n.getAttribute("r")),s=new ko(0,0,o);return s.stroke="none",s.fill="black",on.call(this,n,s,e),s.translation.x=i,s.translation.y=r,s},ellipse:function(n,e){const i=parseFloat(n.getAttribute("cx")),r=parseFloat(n.getAttribute("cy")),o=parseFloat(n.getAttribute("rx")),s=parseFloat(n.getAttribute("ry")),a=new Co(0,0,o,s);return a.stroke="none",a.fill="black",on.call(this,n,a,e),a.translation.x=i,a.translation.y=r,a},rect:function(n,e){const i=parseFloat(n.getAttribute("rx")),r=parseFloat(n.getAttribute("ry"));if(!oe.isNaN(i)||!oe.isNaN(r))return Ue["rounded-rect"](n);const o=parseFloat(n.getAttribute("width")),s=parseFloat(n.getAttribute("height")),a=o/2,l=s/2,c=new di(0,0,o,s);return c.stroke="none",c.fill="black",on.call(this,n,c,e),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(n,e){const i=parseFloat(n.getAttribute("rx"))||0,r=parseFloat(n.getAttribute("ry"))||0,o=parseFloat(n.getAttribute("width")),s=parseFloat(n.getAttribute("height")),a=o/2,l=s/2,c=new re(i,r),d=new vo(0,0,o,s,c);return d.stroke="none",d.fill="black",on.call(this,n,d,e),d.translation.x+=a,d.translation.y+=l,d},line:function(n,e){const i=parseFloat(n.getAttribute("x1")),r=parseFloat(n.getAttribute("y1")),o=parseFloat(n.getAttribute("x2")),s=parseFloat(n.getAttribute("y2")),a=new No(i,r,o,s).noFill();return on.call(this,n,a,e),a},lineargradient:function(n,e){let i=n.getAttribute("gradientUnits"),r=n.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(n.getAttribute("x1")||0),s=parseFloat(n.getAttribute("y1")||0),a=parseFloat(n.getAttribute("x2")||0),l=parseFloat(n.getAttribute("y2")||0);const c=(a+o)/2,d=(l+s)/2;/userSpaceOnUse/i.test(i)&&(o-=c,s-=d,a-=c,l-=d);const u=[];for(let h=0;h<n.children.length;h++){const p=n.children[h];let m=p.getAttribute("offset");/%/gi.test(m)&&(m=parseFloat(m.replace(/%/gi,""))/100),m=parseFloat(m);let g=p.getAttribute("stop-color"),b=p.getAttribute("stop-opacity"),y=p.getAttribute("style"),_;g===null&&(_=y?y.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,g=_&&_.length>1?_[1]:void 0),b===null?(_=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=_&&_.length>1?parseFloat(_[1]):1):b=parseFloat(b),u.push(new ci(m,g,b))}const f=new Ge(o,s,a,l,u);return f.spread=r,f.units=i,on.call(this,n,f,e),f},radialgradient:function(n,e){let i=n.getAttribute("gradientUnits"),r=n.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(n.getAttribute("cx"))||0,s=parseFloat(n.getAttribute("cy"))||0,a=parseFloat(n.getAttribute("r")),l=parseFloat(n.getAttribute("fx")),c=parseFloat(n.getAttribute("fy"));oe.isNaN(l)&&(l=o),oe.isNaN(c)&&(c=s);const d=Math.abs(o+l)/2,u=Math.abs(s+c)/2;/userSpaceOnUse/i.test(i)&&(o-=d,s-=u,l-=d,c-=u);const f=[];for(let p=0;p<n.children.length;p++){const m=n.children[p];let g=m.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let b=m.getAttribute("stop-color"),y=m.getAttribute("stop-opacity"),_=m.getAttribute("style"),k;b===null&&(k=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,b=k&&k.length>1?k[1]:void 0),y===null?(k=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=k&&k.length>1?parseFloat(k[1]):1):y=parseFloat(y),f.push(new ci(g,b,y))}const h=new Ze(o,s,a,f,l,c);return h.spread=r,h.units=i,on.call(this,n,h,e),h},text:function(n,e){const i=k0(n.getAttribute("text-anchor"))||"left",r=C0(n)||"baseline";let o="";n.childNodes.length>0&&n.childNodes[0].tagName==="TSPAN"?o=n.childNodes[0].textContent:o=n.textContent;const s=new Sn(o);return on.call(this,n,s,e),s.alignment=i,s.baseline=r,s},clippath:function(n,e){return Ue.defs.current&&!Ue.defs.current.contains(n.id)&&Ue.defs.current.add(n.id,n),null},image:function(n,e){let i;const r=n.getAttribute("href")||n.getAttribute("xlink:href");if(!r)return i=new Ht("encountered <image /> with no href."),console.warn(i.name,i.message),null;const o=parseFloat(n.getAttribute("x"))||0,s=parseFloat(n.getAttribute("y"))||0,a=parseFloat(n.getAttribute("width")),l=parseFloat(n.getAttribute("height")),c=new xo(r,o,s);return oe.isNaN(a)||(c.width=a),oe.isNaN(l)||(c.height=l),on.call(this,n,c,e),c}};function Nd(n,e){const i=new XMLHttpRequest;return i.open("GET",n),i.onreadystatechange=function(){i.readyState===4&&i.status===200&&e(i.responseText)},i.send(),i}var la=class Dn extends di{constructor(e,i,r,o,s,a){super(i,r,o||1,s||1),S(this,"_flagTexture",!1),S(this,"_flagMode",!1),S(this,"_texture",null),S(this,"_mode","fill"),this._renderer.type="image";for(let l in $d)Object.defineProperty(this,l,$d[l]);this.noStroke(),this.noFill(),e instanceof ze?this.texture=e:typeof e=="string"&&(this.texture=new ze(e)),typeof a=="string"&&(this.mode=a),this._update()}static fromObject(e){const i=new Dn().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Dn.Properties.length;i++){const r=Dn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new Dn(this.texture,this.translation.x,this.translation.y,this.width,this.height);return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image",e.texture=this.texture.toObject(),e.mode=this.mode,e}dispose(){return super.dispose(),this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture;if(e&&(this._flagTexture&&(this.fill=e),e.loaded)){const i=e.image.width,r=e.image.height,o=this.width,s=this.height,a=o/i,l=s/r;switch(this._mode){case Dn.Modes.fill:{const c=Math.max(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="repeat";break}case Dn.Modes.fit:{const c=Math.min(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="no-repeat";break}case Dn.Modes.crop:break;case Dn.Modes.tile:{e.offset.x=(i-o)/2,e.offset.y=(r-s)/2,e.repeat="repeat";break}case Dn.Modes.stretch:default:e.scale=new re(a,l),e.offset.x=0,e.offset.y=0,e.repeat="repeat"}}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagTexture=this._flagMode=!1,this}};S(la,"Modes",{fill:"fill",fit:"fit",crop:"crop",tile:"tile",stretch:"stretch"}),S(la,"Properties",["texture","mode"]);var Td=la,$d={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},mode:{enumerable:!0,get:function(){return this._mode},set:function(n){this._mode=n,this._flagMode=!0}}},ca=[],da=Math.max,E0=Math.min,Ed=Math.abs,To=Math.sin,$o=Math.cos,R0=Math.acos,Eo=Math.sqrt,Ve={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(n){return n in Ve?n:"path"},group:{renderChild:function(n){const e=Ve.getRendererType(n._renderer.type);Ve[e].render.call(n,this.ctx,!0,this.clip)},render:function(n){if(!this._visible)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);const r=this._mask,o=Ro(e),s=!o||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=n,s&&(n.save(),o||n.transform(e[0],e[3],e[1],e[4],e[2],e[5])),r){const a=Ve.getRendererType(r._renderer.type);Ve[a].render.call(r,n,!0)}if(this._opacity>0&&this._scale!==0)for(let a=0;a<this.children.length;a++){const l=this.children[a],c=Ve.getRendererType(l._renderer.type);Ve[c].render.call(l,n)}return s&&n.restore(),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(n,e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_,k,x,v,B,w,T,C,$,E,I,R,O,U,Q,G,W,D,L;if(L=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,U=this._mask,Q=this._clip,l=this._opacity*(L||1),c=this._visible,!e&&(!c||Q||l===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,d=this._cap,u=this._join,f=this._miter,h=this._closed,p=this._renderer.vertices,m=p.length,g=m-1,G=Ro(r),D=this.dashes,G||(n.save(),n.transform(r[0],r[3],r[1],r[4],r[2],r[5])),U){const A=Ve.getRendererType(U._renderer.type);Ve[A].render.call(U,n,!0)}if(a)if(typeof a=="string")n.fillStyle=a;else{const A=Ve.getRendererType(a._renderer.type);Ve[A].render.call(a,n,this),n.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")n.strokeStyle=o;else{const A=Ve.getRendererType(o._renderer.type);Ve[A].render.call(o,n,this),n.strokeStyle=o._renderer.effect}s&&(n.lineWidth=vn(this)),f&&(n.miterLimit=f),u&&(n.lineJoin=u),!h&&d&&(n.lineCap=d)}typeof l=="number"&&(n.globalAlpha=l),D&&D.length>0&&(n.lineDashOffset=D.offset||0,n.setLineDash(D)),n.beginPath();let z,P,q,K,J,Y,V;for(let A=0;A<m;A++)switch(_=p[A],R=_.x,O=_.y,_.command){case ne.close:n.closePath();break;case ne.arc:z=_.rx,P=_.ry,q=_.xAxisRotation,K=_.largeArcFlag,J=_.sweepFlag,b=h?st(A-1,m):da(A-1,0),y=p[b],Y=y.x,V=y.y,Ve.renderSvgArcCommand(n,Y,V,z,P,K,J,q,R,O);break;case ne.curve:b=h?st(A-1,m):Math.max(A-1,0),y=p[b],C=y.controls&&y.controls.right||re.zero,$=_.controls&&_.controls.left||re.zero,y._relative?(w=C.x+y.x,T=C.y+y.y):(w=C.x,T=C.y),_._relative?(v=$.x+_.x,B=$.y+_.y):(v=$.x,B=$.y),n.bezierCurveTo(w,T,v,B,R,O),A>=g&&h&&(k=x,E=_.controls&&_.controls.right||re.zero,I=k.controls&&k.controls.left||re.zero,_._relative?(w=E.x+_.x,T=E.y+_.y):(w=E.x,T=E.y),k._relative?(v=I.x+k.x,B=I.y+k.y):(v=I.x,B=I.y),R=k.x,O=k.y,n.bezierCurveTo(w,T,v,B,R,O));break;case ne.line:n.lineTo(R,O);break;case ne.move:x=_,n.moveTo(R,O);break}return h&&n.closePath(),!Q&&!i&&(Ve.isHidden.test(a)||(W=a._renderer&&a._renderer.offset,W&&(n.save(),n.translate(-a._renderer.offset.x,-a._renderer.offset.y),n.scale(a._renderer.scale.x,a._renderer.scale.y)),n.fill(),W&&n.restore()),Ve.isHidden.test(o)||(W=o._renderer&&o._renderer.offset,W&&(n.save(),n.translate(-o._renderer.offset.x,-o._renderer.offset.y),n.scale(o._renderer.scale.x,o._renderer.scale.y),n.lineWidth=s/o._renderer.scale.x),n.stroke(),W&&n.restore())),G||n.restore(),Q&&!i&&n.clip(),D&&D.length>0&&n.setLineDash(ca),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(n,e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_;if(_=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(_||1),c=this._visible,!e&&(!c||l===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,u=this._renderer.collection,f=u.length,g=Ro(r),y=this.dashes,d=this._size,g||(n.save(),n.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")n.fillStyle=a;else{const v=Ve.getRendererType(a._renderer.type);Ve[v].render.call(a,n,this),n.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")n.strokeStyle=o;else{const v=Ve.getRendererType(o._renderer.type);Ve[v].render.call(o,n,this),n.strokeStyle=o._renderer.effect}s&&(n.lineWidth=vn(this))}typeof l=="number"&&(n.globalAlpha=l),y&&y.length>0&&(n.lineDashOffset=y.offset||0,n.setLineDash(y)),n.beginPath();let k=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=ki(x[0],x[3],x[1],x[4],x[2],x[5]),k/=Math.max(x.scaleX,x.scaleY));for(let v=0;v<f;v++)h=u[v],p=h.x,m=h.y,n.moveTo(p+k,m),n.arc(p,m,k,0,tt);return i||(Ve.isHidden.test(a)||(b=a._renderer&&a._renderer.offset,b&&(n.save(),n.translate(-a._renderer.offset.x,-a._renderer.offset.y),n.scale(a._renderer.scale.x,a._renderer.scale.y)),n.fill(),b&&n.restore()),Ve.isHidden.test(o)||(b=o._renderer&&o._renderer.offset,b&&(n.save(),n.translate(-o._renderer.offset.x,-o._renderer.offset.y),n.scale(o._renderer.scale.x,o._renderer.scale.y),n.lineWidth=s/o._renderer.scale.x),n.stroke(),b&&n.restore())),g||n.restore(),y&&y.length>0&&n.setLineDash(ca),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(n,e,i){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*r,s=this._visible,a=this._mask,l=this._clip;if(!e&&(!s||l||o===0))return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,u=this._linewidth,f=this._fill,h=this._decoration,p=this._direction,m=Ro(c),g=f._renderer&&f._renderer.offset&&d._renderer&&d._renderer.offset,b=this.dashes,y=Ve.alignments[this._alignment]||this._alignment,_=Ve.baselines[this._baseline]||this._baseline;let k,x,v,B,w,T,C,$,E,I,R;if(m||(n.save(),n.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const O=Ve.getRendererType(a._renderer.type);Ve[O].render.call(a,n,!0)}if(g||(n.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),n.textAlign=y,n.textBaseline=_,n.direction=p,f)if(typeof f=="string")n.fillStyle=f;else{const O=Ve.getRendererType(f._renderer.type);Ve[O].render.call(f,n,this),n.fillStyle=f._renderer.effect}if(d){if(typeof d=="string")n.strokeStyle=d;else{const O=Ve.getRendererType(d._renderer.type);Ve[O].render.call(d,n,this),n.strokeStyle=d._renderer.effect}u&&(n.lineWidth=vn(this))}if(typeof o=="number"&&(n.globalAlpha=o),b&&b.length>0&&(n.lineDashOffset=b.offset||0,n.setLineDash(b)),!l&&!i&&(Ve.isHidden.test(f)||(f._renderer&&f._renderer.offset?(T=f._renderer.scale.x,C=f._renderer.scale.y,n.save(),n.translate(-f._renderer.offset.x,-f._renderer.offset.y),n.scale(T,C),k=this._size/f._renderer.scale.y,x=this._leading/f._renderer.scale.y,n.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),v=f._renderer.offset.x/f._renderer.scale.x,B=f._renderer.offset.y/f._renderer.scale.y,n.fillText(this.value,v,B),n.restore()):n.fillText(this.value,0,0)),Ve.isHidden.test(d)||(d._renderer&&d._renderer.offset?(T=d._renderer.scale.x,C=d._renderer.scale.y,n.save(),n.translate(-d._renderer.offset.x,-d._renderer.offset.y),n.scale(T,C),k=this._size/d._renderer.scale.y,x=this._leading/d._renderer.scale.y,n.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),v=d._renderer.offset.x/d._renderer.scale.x,B=d._renderer.offset.y/d._renderer.scale.y,w=u/d._renderer.scale.x,n.lineWidth=w,n.strokeText(this.value,v,B),n.restore()):n.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(h)){const O=n.measureText(this.value);let U=1;switch(h){case"underline":E=O.actualBoundingBoxDescent,R=O.actualBoundingBoxDescent;break;case"strikethrough":E=0,R=0,U=.5;break}switch(_){case"top":E+=this._size*U,R+=this._size*U;break;case"baseline":case"bottom":E-=this._size*U,R-=this._size*U;break}switch(y){case"left":case"start":$=0,I=O.width;break;case"right":case"end":$=-O.width,I=0;break;default:$=-O.width/2,I=O.width/2}n.lineWidth=Math.max(Math.floor(this._size/15),1),n.strokeStyle=n.fillStyle,n.beginPath(),n.moveTo($,E),n.lineTo(I,R),n.stroke()}return m||n.restore(),l&&!i&&n.clip(),b&&b.length>0&&n.setLineDash(ca),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=n.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,a=(a-.5)*i.height*.5,l*=Math.min(i.width,i.height)),this._renderer.effect=n.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=n.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,e&&(this._renderer.offset.x+=e.width/2,this._renderer.offset.y+=e.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(n,e,i,r,o,s,a,l,c,d){l=l*Math.PI/180,r=Ed(r),o=Ed(o);const u=(e-c)/2,f=(i-d)/2,h=$o(l)*u+To(l)*f,p=-To(l)*u+$o(l)*f,m=h*h,g=p*p;let b=r*r,y=o*o;const _=m/b+g/y;if(_>1){const O=Eo(_);r=O*r,o=O*o,b=r*r,y=o*o}const k=b*g+y*m,x=(b*y-k)/k;let v=Eo(da(0,x));s===a&&(v=-v);const B=v*r*p/o,w=-v*o*h/r,T=$o(l)*B-To(l)*w+(e+c)/2,C=To(l)*B+$o(l)*w+(i+d)/2,$=Rd(1,0,(h-B)/r,(p-w)/o),E=Rd((h-B)/r,(p-w)/o,(-h-B)/r,(-p-w)/o)%tt,I=$+E;P0(n,T,C,r,o,$,I,a===0,l)}},St=class extends ee{constructor(n){super();const e=n.smoothing!==!1;this.domElement=n.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=n.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=e),this.scene=new yt,this.scene.parent=this}setSize(n,e,i){return this.width=n,this.height=e,this.ratio=typeof i>"u"?zs(this.ctx):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&oe.extend(this.domElement.style,{width:n+"px",height:e+"px"}),this.trigger(ee.Types.resize,n,e,i)}render(){const n=this.ratio===1;return n||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Ve.group.render.call(this.scene,this.ctx),n||this.ctx.restore(),this}};S(St,"Utils",Ve);function P0(n,e,i,r,o,s,a,l,c){const d=a-s,u=Qi.Tolerance.epsilon,f=Math.abs(d)<u;let h=st(d,tt);h<u&&(f?h=0:h=tt),l===!0&&!f&&(h===tt?h=-tt:h=h-tt);for(let p=0;p<Ct.Resolution;p++){const m=p/(Ct.Resolution-1),g=s+m*h;let b=e+r*Math.cos(g),y=i+o*Math.sin(g);if(c!==0){const _=Math.cos(c),k=Math.sin(c),x=b-e,v=y-i;b=x*_-v*k+e,y=x*k+v*_+i}n.lineTo(b,y)}}function Rd(n,e,i,r){const o=n*i+e*r,s=Eo(n*n+e*e)*Eo(i*i+r*r);let a=R0(da(-1,E0(1,o/s)));return n*r-e*i<0&&(a=-a),a}function Ro(n){return n[0]===1&&n[3]===0&&n[1]===0&&n[4]===1&&n[2]===0&&n[5]===0}var ue={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},baselines:{top:"hanging",middle:"middle",bottom:"ideographic",baseline:"alphabetic"},createElement:function(n,e){const i=n,r=document.createElementNS(ue.ns,i);return i==="svg"&&(e=oe.defaults(e||{},{version:ue.version})),e&&Object.keys(e).length>0&&ue.setAttributes(r,e),r},setAttributes:function(n,e){const i=Object.keys(e);for(let r=0;r<i.length;r++)/href/.test(i[r])?n.setAttributeNS(ue.xlink,i[r],e[i[r]]):n.setAttribute(i[r],e[i[r]]);return this},removeAttributes:function(n,e){for(let i in e)n.removeAttribute(i);return this},toString:function(n,e){let i=n.length,r=i-1,o,s="";for(let a=0;a<i;a++){const l=n[a],c=e?st(a-1,i):Math.max(a-1,0),d=n[c];let u,f,h,p,m,g,b,y,_,k,x,v,B,w,T,C=Oe(l.x),$=Oe(l.y);switch(l.command){case ne.close:u=ne.close;break;case ne.arc:x=l.rx,v=l.ry,B=l.xAxisRotation,w=l.largeArcFlag,T=l.sweepFlag,u=ne.arc+" "+x+" "+v+" "+B+" "+w+" "+T+" "+C+" "+$;break;case ne.curve:b=d.controls&&d.controls.right||re.zero,y=l.controls&&l.controls.left||re.zero,d.relative?(h=Oe(b.x+d.x),p=Oe(b.y+d.y)):(h=Oe(b.x),p=Oe(b.y)),l.relative?(m=Oe(y.x+l.x),g=Oe(y.y+l.y)):(m=Oe(y.x),g=Oe(y.y)),u=(a===0?ne.move:ne.curve)+" "+h+" "+p+" "+m+" "+g+" "+C+" "+$;break;case ne.move:o=l,u=ne.move+" "+C+" "+$;break;default:u=l.command+" "+C+" "+$}a>=r&&e&&(l.command===ne.curve&&(f=o,_=l.controls&&l.controls.right||l,k=f.controls&&f.controls.left||f,l.relative?(h=Oe(_.x+l.x),p=Oe(_.y+l.y)):(h=Oe(_.x),p=Oe(_.y)),f.relative?(m=Oe(k.x+f.x),g=Oe(k.y+f.y)):(m=Oe(k.x),g=Oe(k.y)),C=Oe(f.x),$=Oe(f.y),u+=" C "+h+" "+p+" "+m+" "+g+" "+C+" "+$),l.command!==ne.close&&(u+=" Z")),s+=u+" "}return s},pointsToString:function(n,e){let i="";const r=e*.5;for(let o=0;o<n.length;o++){const s=n[o].x,a=n[o].y-r;i+=ne.move+" "+s+" "+a+" ",i+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return i},getClip:function(n,e){let i=n._renderer.clip;return i||(i=n._renderer.clip=ue.createElement("clipPath",{"clip-rule":"nonzero"})),i.parentNode===null&&e.defs.appendChild(i),i},getRendererType:function(n){return n in ue?n:"path"},defs:{update:function(n){const{defs:e}=n;if(e._flagUpdate){const i=Array.prototype.slice.call(e.children,0);for(let r=0;r<i.length;r++){const o=i[r],s=o.id,a=`[fill="url(#${s})"],[stroke="url(#${s})"],[clip-path="url(#${s})"]`;n.querySelector(a)||e.removeChild(o)}e._flagUpdate=!1}}},group:{appendChild:function(n){const e=n._renderer.elem;if(!e)return;const i=e.nodeName;!i||/(radial|linear)gradient/i.test(i)||n._clip||this.elem.appendChild(e)},removeChild:function(n){const e=n._renderer.elem;!e||e.parentNode!=this.elem||!e.nodeName||n._clip||this.elem.removeChild(e)},orderChild:function(n){this.elem.appendChild(n._renderer.elem)},renderChild:function(n){const e=ue.getRendererType(n._renderer.type);ue[e].render.call(n,this)},render:function(n){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=ue.createElement("g",{id:this.id}),n.appendChild(this._renderer.elem));const e=this._matrix.manual||this._flagMatrix,i={domElement:n,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const o=this.children[r],s=ue.getRendererType(o._renderer.type);ue[s].render.call(o,n)}if(this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(ue.group.appendChild,i),this._flagSubtractions&&this.subtractions.forEach(ue.group.removeChild,i),this._flagOrder&&this.children.forEach(ue.group.orderChild,i),this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.dataset&&Object.assign(this._renderer.elem.dataset,this.dataset),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(n){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices){const r=ue.toString(this._renderer.vertices,this._closed);e.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,n,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=vn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("path",e),n.appendChild(this._renderer.elem)),this._flagClip){const r=ue.getClip(this,n),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(n){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const s=this.worldMatrix.elements,a=ki(s[0],s[3],s[1],s[4],s[2],s[5]);r/=Math.max(a.scaleX,a.scaleY)}const o=ue.pointsToString(this._renderer.collection,r);e.d=o}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,n,!0)}return this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=vn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("path",e),n.appendChild(this._renderer.elem)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(n){this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=ue.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["dominant-baseline"]=ue.baselines[this._baseline]||this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._flagDirection&&(e.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ue.getRendererType(this._fill._renderer.type);ue[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ue.getRendererType(this._stroke._renderer.type);ue[r].render.call(this._stroke,n,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=vn(this)),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ue.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ue.createElement("text",e),n.appendChild(this._renderer.elem)),this._flagClip){const r=ue.getClip(this,n),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ue.getRendererType(this._mask._renderer.type);ue[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(n,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?ue.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=ue.createElement("linearGradient",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?ue.setAttributes(s._renderer.elem,a):s._renderer.elem=ue.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(n,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagCenter&&(i.cx=this.center._x,i.cy=this.center._y),this._flagFocal&&(i.fx=this.focal._x,i.fy=this.focal._y),this._flagRadius&&(i.r=this._radius),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?ue.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=ue.createElement("radialGradient",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?ue.setAttributes(s._renderer.elem,a):s._renderer.elem=ue.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(n,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={},r={x:0,y:0},o=this.image;if(this._flagId&&(i.id=this._id),this._flagLoaded&&this.loaded)switch(o.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=o.toDataURL("image/png");break;case"img":case"image":r.href=r["xlink:href"]=this.src;break}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(i.x=this._offset.x,i.y=this._offset.y,o&&(i.x-=o.width/2,i.y-=o.height/2,this._scale instanceof re?(i.x*=this._scale.x,i.y*=this._scale.y):(i.x*=this._scale,i.y*=this._scale)),i.x>0&&(i.x*=-1),i.y>0&&(i.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,o)){switch(i.width=o.width,i.height=o.height,this._repeat){case"no-repeat":i.width+=1,i.height+=1;break}this._scale instanceof re?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale),/no-repeat/i.test(this._repeat)?r.preserveAspectRatio="xMidYMid":r.preserveAspectRatio="none",r.width=i.width,r.height=i.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?ue.setAttributes(this._renderer.image,r):this._renderer.image=ue.createElement("image",r)),this._renderer.elem?Object.keys(i).length!==0&&ue.setAttributes(this._renderer.elem,i):(i.id=this._id,i.patternUnits="userSpaceOnUse",this._renderer.elem=ue.createElement("pattern",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},Pd=class extends ee{constructor(n){super(),this.domElement=n.domElement||ue.createElement("svg"),this.scene=new yt,this.scene.parent=this,this.defs=ue.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(n,e){return this.width=n,this.height=e,ue.setAttributes(this.domElement,{width:n,height:e}),this.trigger(ee.Types.resize,n,e)}render(){return ue.group.render.call(this.scene,this.domElement),ue.defs.update(this.domElement),this}};S(Pd,"Utils",ue);var sn={create:function(n,e,i){const r=n.createShader(n[i]);if(n.shaderSource(r,e),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS)){const s=n.getShaderInfoLog(r);throw n.deleteShader(r),new Ht("unable to compile shader "+r+": "+s)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
|
|
41
41
|
precision mediump float;
|
|
42
42
|
attribute vec2 a_position;
|
|
43
43
|
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
}
|
|
101
101
|
gl_FragColor = texel;
|
|
102
102
|
}
|
|
103
|
-
`}},Po=vi.Multiply,F0=[1,0,0,0,1,0,0,0,1],ui=new Cn(9),V0=St.Utils,Fd=new re,ua=new Cn([0,0,1,0,0,1,0,1,1,0,1,1]),Se={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Ke.document?Ke.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new vi,group:{removeChild:function(n,e){if(n.children)for(let i=0;i<n.children.length;i++)Se.group.removeChild(n.children[i],e);n._renderer.texture&&(e.deleteTexture(n._renderer.texture),delete n._renderer.texture),n._renderer.positionBuffer&&(e.deleteBuffer(n._renderer.positionBuffer),delete n._renderer.positionBuffer)},render:function(n,e){if(!this._visible)return;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.parent,r=i._matrix&&i._matrix.manual||i._flagMatrix,o=this._matrix.manual||this._flagMatrix;if((r||o)&&(this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,i._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(i._renderer.type)||(this._renderer.scale.x*=i._renderer.scale.x,this._renderer.scale.y*=i._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const a=St.Utils.getRendererType(this._mask._renderer.type);Se[a].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}this._flagOpacity=i._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);let s;if(this._flagSubtractions)for(s=0;s<this.subtractions.length;s++)Se.group.removeChild(this.subtractions[s],n);for(s=0;s<this.children.length;s++){const a=this.children[s],l=St.Utils.getRendererType(a._renderer.type);Se[l].render.call(a,n,e)}return this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(n,e){let i,r,o,s,a,l,c,d,u,f,h,p,m,g;const b=e._renderer.vertices,y=this.canvas,_=this.ctx,k=n.renderer.ratio,x=Fd.copy(e._renderer.scale).multiply(k),v=e._stroke,B=e._linewidth,w=e._fill,T=e._renderer.opacity||e._opacity,C=e._cap,$=e._join,E=e._miter,I=e._closed,R=e.dashes,O=b.length,U=O-1;y.width=Math.max(Math.ceil(e._renderer.rect.width*x.x),1),y.height=Math.max(Math.ceil(e._renderer.rect.height*x.y),1);const Q=e._renderer.rect.centroid,G=Q.x,W=Q.y;if(_.clearRect(0,0,y.width,y.height),w)if(typeof w=="string")_.fillStyle=w;else{const V=St.Utils.getRendererType(w._renderer.type);Se[V].render.call(w,_,e),_.fillStyle=w._renderer.effect}if(v){if(typeof v=="string")_.strokeStyle=v;else{const V=St.Utils.getRendererType(v._renderer.type);Se[V].render.call(v,_,e),_.strokeStyle=v._renderer.effect}B&&(_.lineWidth=vn(e)),E&&(_.miterLimit=E),$&&(_.lineJoin=$),!I&&C&&(_.lineCap=C)}typeof T=="number"&&(_.globalAlpha=T),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let D,L,z,P,q,K,J,Y;_.save(),_.scale(x.x,x.y),_.translate(G,W),_.beginPath();for(let V=0;V<b.length;V++){const A=b[V];switch(p=A.x,m=A.y,A.command){case ne.close:_.closePath();break;case ne.arc:L=A.rx,z=A.ry,P=A.xAxisRotation,q=A.largeArcFlag,K=A.sweepFlag,i=I?st(V-1,O):Math.max(V-1,0),r=b[i],J=r.x,Y=r.y,V0.renderSvgArcCommand(_,J,Y,L,z,q,K,P,p,m);break;case ne.curve:i=I?st(V-1,O):Math.max(V-1,0),r=b[i],d=r.controls&&r.controls.right||re.zero,u=A.controls&&A.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),A._relative?(s=u.x+A.x,a=u.y+A.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,p,m),V>=U&&I&&(o=D,f=A.controls&&A.controls.right||re.zero,h=o.controls&&o.controls.left||re.zero,A._relative?(l=f.x+A.x,c=f.y+A.y):(l=f.x,c=f.y),o._relative?(s=h.x+o.x,a=h.y+o.y):(s=h.x,a=h.y),p=o.x,m=o.y,_.bezierCurveTo(l,c,s,a,p,m));break;case ne.line:_.lineTo(p,m);break;case ne.move:D=A,_.moveTo(p,m);break}}I&&_.closePath(),Se.isHidden.test(w)||(g=w._renderer&&w._renderer.offset,g&&(_.save(),_.translate(-w._renderer.offset.x,-w._renderer.offset.y),_.scale(w._renderer.scale.x,w._renderer.scale.y)),_.fill(),g&&_.restore()),Se.isHidden.test(v)||(g=v._renderer&&v._renderer.offset,g&&(_.save(),_.translate(-v._renderer.offset.x,-v._renderer.offset.y),_.scale(v._renderer.scale.x,v._renderer.scale.y),_.lineWidth=B/v._renderer.scale.x),_.stroke(),g&&_.restore()),_.restore()},getBoundingClientRect:function(n,e,i){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;n.forEach(function(d){const u=d.x,f=d.y,h=d.controls;let p,m,g,b,y,_;s=Math.min(f,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(f,a),d.controls&&(y=h.left,_=h.right,!(!y||!_)&&(p=d._relative?y.x+u:y.x,m=d._relative?y.y+f:y.y,g=d._relative?_.x+u:_.x,b=d._relative?_.y+f:_.y,!(!p||!m||!g||!b)&&(s=Math.min(m,b,s),r=Math.min(p,g,r),o=Math.max(p,g,o),a=Math.max(m,b,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,i.top=s,i.left=r,i.right=o,i.bottom=a,i.width=l,i.height=c,i.centroid||(i.centroid={}),i.centroid.x=-r,i.centroid.y=-s},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=St.Utils.getRendererType(this._renderer.type),s=e[o],a=r._matrix.manual||r._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._flagVertices||this._flagFill||this._fill instanceof Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let f,h;this._scale instanceof re?(f=this._scale.x*r._renderer.scale.x,h=this._scale.y*r._renderer.scale.y):(f=this._scale*r._renderer.scale.x,h=this._scale*r._renderer.scale.y),this._renderer.scale.x=f<0?-f:f,this._renderer.scale.y=h<0?-h:h,c&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const f=St.Utils.getRendererType(this._mask._renderer.type);Se[f].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==s&&(n.useProgram(s),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,ua,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(n,e){let i;const r=this.canvas,o=this.ctx,s=n.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._size*s;let h=f;Se.isHidden.test(a)||(h+=l),r.width=_c(h),r.height=r.width;const p=h/r.width,m=r.width/2,g=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const b=St.Utils.getRendererType(c._renderer.type);Se[b].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const b=St.Utils.getRendererType(a._renderer.type);Se[b].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=vn(e)/p)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(m,g),o.scale(Se.precision,Se.precision),o.beginPath(),o.arc(0,0,f/p*.5,0,tt),o.restore(),closed&&o.closePath(),Se.isHidden.test(c)||(i=c._renderer&&c._renderer.offset,i&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),i&&o.restore()),Se.isHidden.test(a)||(i=a._renderer&&a._renderer.offset,i&&(o.save(),o.translate(-a._renderer.offset.x,-a._renderer.offset.y),o.scale(a._renderer.scale.x,a._renderer.scale.y),o.lineWidth=l/a._renderer.scale.x),o.stroke(),i&&o.restore())},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=i||this.parent,s=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=o._matrix.manual||o._flagMatrix,u=this._matrix.manual||this._flagMatrix,f=this._renderer.parent!==o,h=this._renderer.vertices,p=this._renderer.collection.length,m=this._flagVertices,g=this._flagFill||this._fill instanceof Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||o._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||u||f){this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let b,y;this._scale instanceof re?(b=this._scale.x*o._renderer.scale.x,y=this._scale.y*o._renderer.scale.y):(b=this._scale*o._renderer.scale.x,y=this._scale*o._renderer.scale.y),this._renderer.scale.x=b<0?-b:b,this._renderer.scale.y=y<0?-y:y,f&&(this._renderer.parent=o)}if(m){const b=this._renderer.positionBuffer;b&&n.deleteBuffer(b),this._renderer.positionBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this._renderer.positionBuffer),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,h,n.STATIC_DRAW)}return g?(this._renderer.opacity=this._opacity*o._renderer.opacity,Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture?this:(Se.isHidden.test(l)||(r+=c),r/=Se.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(n.useProgram(s),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture),n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform1f(s.size,r*e.resolution.ratio),n.drawArrays(n.POINTS,0,p),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(n,e){const i=this.canvas,r=this.ctx,o=n.renderer.ratio,s=Fd.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._decoration,h=e._direction;i.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),i.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const p=e._renderer.rect.centroid,m=p.x,g=p.y;let b,y,_,k,x,v,B,w,T,C,$;const E=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,i.width,i.height),E||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=h,c)if(typeof c=="string")r.fillStyle=c;else{const I=St.Utils.getRendererType(c._renderer.type);Se[I].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const I=St.Utils.getRendererType(a._renderer.type);Se[I].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=vn(e))}if(typeof d=="number"&&(r.globalAlpha=d),u&&u.length>0&&(r.lineDashOffset=u.offset||0,r.setLineDash(u)),r.save(),r.scale(s.x,s.y),r.translate(m,g),Se.isHidden.test(c)||(c._renderer&&c._renderer.offset?(v=c._renderer.scale.x,B=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(v,B),b=e._size/c._renderer.scale.y,y=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,k=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,k),r.restore()):r.fillText(e.value,0,0)),Se.isHidden.test(a)||(a._renderer&&a._renderer.offset?(v=a._renderer.scale.x,B=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(v,B),b=e._size/a._renderer.scale.y,y=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,k=a._renderer.offset.y/a._renderer.scale.y,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(e.value,_,k),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(f)){const I=r.measureText(e.value);switch(f){case"underline":T=I.actualBoundingBoxDescent,$=I.actualBoundingBoxDescent;break;case"strikethrough":T=0,$=0;break}w=-I.width/2,C=I.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(w,T),r.lineTo(C,$),r.stroke()}r.restore()},getBoundingClientRect:function(n,e){const i=Se.ctx;i.font=[n._style,n._weight,n._size+"px/"+n._leading+"px",n._family].join(" "),i.textAlign="center",i.textBaseline=St.Utils.baselines[n._baseline]||n._baseline;const r=i.measureText(n._value);let o=r.width,s=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!Se.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(Se.alignments[n._alignment]||n._alignment){case Se.alignments.left:n.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case Se.alignments.right:n.direction==="ltr"?(e.left=-o,e.right=0):(e.left=0,e.right=o);break;default:e.left=-a,e.right=a}switch(n._baseline){case"bottom":e.top=-s,e.bottom=0;break;case"top":e.top=0,e.bottom=s;break;case"baseline":e.top=-l*1.5,e.bottom=l*.5;break;default:e.top=-l,e.bottom=l}e.width=o,e.height=s,e.centroid||(e.centroid={}),e.centroid.x=a,e.centroid.y=l},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=e[this._renderer.type],s=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(s||a||l){this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let u,f;this._scale instanceof re?(u=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=f<0?-f:f,l&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const u=St.Utils.getRendererType(this._mask._renderer.type);Se[u].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.text.getBoundingClientRect(this,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==o&&(n.useProgram(o),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(o.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(o.position),n.bufferData(n.ARRAY_BUFFER,ua,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return n.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),n.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=n.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,a=(a-.5)*i.height*.5,l*=Math.min(i.width,i.height)),this._renderer.effect=n.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n,e){if(!n.canvas.getContext("2d"))return;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=n.createPattern(i,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,i&&(this._renderer.offset.x+=i.width/2,this._renderer.offset.y+=i.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),this._flagScale||this._flagLoaded){this._renderer.scale instanceof re||(this._renderer.scale=new re);let r,o;this._scale instanceof re?(r=this._scale.x,o=this._scale.y):(r=this._scale,o=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=o<0?-o:o}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(n,e){const i=St.Utils.getRendererType(e._renderer.type);if(this[i].updateCanvas.call(Se,n,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&n.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=n.createTexture()),n.bindTexture(n.TEXTURE_2D,e._renderer.texture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,this.canvas),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR)},program:{create:function(n,e){let i,r,o;if(i=n.createProgram(),oe.each(e,function(s){n.attachShader(i,s)}),n.linkProgram(i),r=n.getProgramParameter(i,n.LINK_STATUS),!r)throw o=n.getProgramInfoLog(i),n.deleteProgram(i),new Ht("unable to link program: "+o);return i}},extensions:{init:function(n){const e={},i=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<i.length;r++){const o=i[r];e[o]=Se.extensions.get(n,o)}return e},get:function(n,e){return n.getExtension(e)||n.getExtension(`MOZ_${e}`)||n.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new ho};Se.ctx=Se.canvas.getContext("2d");var Vd=class extends ee{constructor(n){super();let e,i,r,o;if(this.domElement=n.domElement||document.createElement("canvas"),typeof n.offscreenElement<"u"&&(Se.canvas=n.offscreenElement,Se.ctx=Se.canvas.getContext("2d")),this.scene=new gt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new Cn(F0),scale:1,opacity:1},this._flagMatrix=!0,n=oe.defaults(n||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=n.overdraw,e=this.ctx=this.domElement.getContext("webgl",n)||this.domElement.getContext("experimental-webgl",n),!this.ctx)throw new Ht("unable to create a webgl context. Try using another renderer.");r=sn.create(e,sn.path.vertex,sn.types.vertex),o=sn.create(e,sn.path.fragment,sn.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},i=this.programs.path=Se.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=Se.extensions.init(e),e.renderer=this,i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.rect=e.getUniformLocation(i,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(i.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(i.position),e.bufferData(e.ARRAY_BUFFER,ua,e.STATIC_DRAW),r=sn.create(e,sn.points.vertex,sn.types.vertex),o=sn.create(e,sn.points.fragment,sn.types.fragment),i=this.programs.points=Se.program.create(e,[r,o]),i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.size=e.getUniformLocation(i,"u_size"),e.enable(e.BLEND),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}setSize(n,e,i){let r,o;const s=this.ctx;return this.width=n,this.height=e,this.ratio=typeof i>"u"?zs(s):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,oe.isObject(this.domElement.style)&&oe.extend(this.domElement.style,{width:n+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=n*this.ratio,o=e*this.ratio,s.viewport(0,0,r,o),this.programs.resolution.width=r,this.programs.resolution.height=o,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(ee.Types.resize,n,e,i)}render(){const n=this.ctx;return this.overdraw||n.clear(n.COLOR_BUFFER_BIT),Se.group.render.call(this.scene,n,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};S(Vd,"Utils",Se);var M0=oe.extend({Error:Ht,getRatio:zs,read:Ue,xhr:Nd},oe,Ft,pc,gc),Te=class ro{constructor(e){S(this,"_events",new ee),S(this,"type",""),S(this,"renderer",null),S(this,"scene",null),S(this,"width",0),S(this,"height",0),S(this,"frameCount",0),S(this,"timeDelta",0),S(this,"playing",!1);const i=oe.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:ro.Types.svg,autostart:!1});if(oe.each(i,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),oe.isElement(i.domElement)){const r=i.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=ro.Types[r])}this.renderer=new ro[this.type](this),this.setPlaying(i.autostart),this.frameCount=0,i.fullscreen?(this.fit=I0.bind(this),this.fit.domElement=window,this.fit.attached=!0,oe.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),oe.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Gt.bind(this.fit.domElement,"resize",this.fit),this.fit()):i.fitted?(this.fit=A0.bind(this),oe.extend(this.renderer.domElement.style,{display:"block"})):typeof i.width=="number"&&typeof i.height=="number"&&(this.renderer.setSize(i.width,i.height,this.ratio),this.width=i.width,this.height=i.height),this.renderer.bind(ee.Types.resize,O0.bind(this)),this.scene=this.renderer.scene,ro.Instances.push(this),i.autostart&&Fr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=this._events.listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=this._events.ignore)==null?void 0:e.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,Fr.init(),this.trigger(ee.Types.play)}pause(){return this.playing=!1,this.trigger(ee.Types.pause)}setPlaying(e){this.playing=e}release(e){let i,r,o;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&typeof e.fill.unbind=="function"&&e.fill.unbind(),typeof e.stroke=="object"&&typeof e.stroke.unbind=="function"&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(i=0;i<e.vertices.length;i++)r=e.vertices[i],typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}if(e.children){for(i=0;i<e.children.length;i++)o=e.children[i],this.release(o);if(typeof e.children.unbind=="function")try{e.children.unbind()}catch{}}if(e._renderer){if(e._renderer.elem&&e._renderer.elem.parentNode&&(e._renderer.elem.parentNode.removeChild(e._renderer.elem),delete e._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const s=this.renderer.ctx;e._renderer.texture&&(s.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(s.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer),e._renderer.effect&&(e._renderer.effect=null)}this.type==="CanvasRenderer"&&e._renderer.context&&delete e._renderer.context}return e}getShapesAtPoint(e,i,r){return this.scene&&typeof this.scene.getShapesAtPoint=="function"?this.scene.getShapesAtPoint(e,i,r):[]}update(){const e=!!this._lastFrame,i=oe.performance.now();e&&(this.timeDelta=parseFloat((i-this._lastFrame).toFixed(3))),this._lastFrame=i,this.fit&&this.fit.domElement&&!this.fit.attached&&(Gt.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,o=this.height,s=this.renderer;return(r!==s.width||o!==s.height)&&s.setSize(r,o,this.ratio),this.trigger(ee.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(ee.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,i,r,o){const s=new No(e,i,r,o);return this.scene.add(s),s}makeArrow(e,i,r,o,s){const a=typeof s=="number"?s:10,l=Math.atan2(o-i,r-e),c=[new Ee(e,i,void 0,void 0,void 0,void 0,ne.move),new Ee(r,o,void 0,void 0,void 0,void 0,ne.line),new Ee(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,ne.line),new Ee(r,o,void 0,void 0,void 0,void 0,ne.move),new Ee(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,ne.line)],d=new Pe(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,i,r,o){const s=new di(e,i,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,i,r,o,s){const a=new vo(e,i,r,o,s);return this.scene.add(a),a}makeCircle(e,i,r,o){const s=new ko(e,i,r,o);return this.scene.add(s),s}makeEllipse(e,i,r,o,s){const a=new Co(e,i,r,o,s);return this.scene.add(a),a}makeStar(e,i,r,o,s){const a=new na(e,i,r,o,s);return this.scene.add(a),a}makeCurve(e){const i=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<i;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new Ee(l,c))}}const r=arguments[i-1],o=new Pe(e,!(typeof r=="boolean"&&r),!0),s=o.getBoundingClientRect();return o.center().translation.set(s.left+s.width/2,s.top+s.height/2),this.scene.add(o),o}makePolygon(e,i,r,o){const s=new ta(e,i,r,o);return this.scene.add(s),s}makeArcSegment(e,i,r,o,s,a,l){const c=new Ks(e,i,r,o,s,a,l);return this.scene.add(c),c}makePoints(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let s=0;s<i;s+=2){const a=arguments[s];if(typeof a!="number")break;const l=arguments[s+1];r.push(new re(a,l))}}const o=new ea(r);return this.scene.add(o),o}makePath(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<i;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Ee(c,d))}}const o=arguments[i-1],s=new Pe(r,!(typeof o=="boolean"&&o)),a=s.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&s.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(s),s}makeText(e,i,r,o){const s=new Sn(e,i,r,o);return this.add(s),s}makeLinearGradient(e,i,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ge(e,i,r,o,s);return this.add(a),a}makeRadialGradient(e,i,r){const o=Array.prototype.slice.call(arguments,3),s=new Ze(e,i,r,o);return this.add(s),s}makeSprite(e,i,r,o,s,a,l){const c=new xo(e,i,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,i,r,o,s,a){const l=new Td(e,i,r,o,s,a);return this.add(l),l}makeImageSequence(e,i,r,o,s){const a=new sa(e,i,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,i){return new ze(e,i)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const i=new gt;return this.scene.add(i),i.add(e),i}interpret(e,i,r){const o=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(o in Ue))return null;const s=Ue[o].call(this,e);return r?this.add(i&&s instanceof gt?s.children:s):s.parent&&s.remove(),s}load(e,i){const r=new gt;let o,s,a;const l=(function(c){for(Gt.temp.innerHTML=c,s=0;s<Gt.temp.children.length;s++)o=Gt.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof i=="function"){const d=Gt.temp.children.length<=1?Gt.temp.children[0]:Gt.temp.children;i(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Nd(e,l),r):(l(e),r)}};S(Te,"NextFrameId",Ct.NextFrameId),S(Te,"Types",Ct.Types),S(Te,"Version",Ct.Version),S(Te,"PublishDate",Ct.PublishDate),S(Te,"Identifier",Ct.Identifier),S(Te,"Resolution",Ct.Resolution),S(Te,"AutoCalculateImportedMatrices",Ct.AutoCalculateImportedMatrices),S(Te,"Instances",Ct.Instances),S(Te,"uniqueId",Ct.uniqueId),S(Te,"Anchor",Ee),S(Te,"Collection",li),S(Te,"Events",ee),S(Te,"Group",gt),S(Te,"Matrix",vi),S(Te,"Path",Pe),S(Te,"Registry",ho),S(Te,"Element",er),S(Te,"Shape",Hn),S(Te,"Text",Sn),S(Te,"Vector",re),S(Te,"Gradient",ut),S(Te,"Image",Td),S(Te,"ImageSequence",sa),S(Te,"LinearGradient",Ge),S(Te,"RadialGradient",Ze),S(Te,"Sprite",xo),S(Te,"Stop",ci),S(Te,"Texture",ze),S(Te,"ArcSegment",Ks),S(Te,"Circle",ko),S(Te,"Ellipse",Co),S(Te,"Line",No),S(Te,"Points",ea),S(Te,"Polygon",ta),S(Te,"Rectangle",di),S(Te,"RoundedRectangle",vo),S(Te,"Star",na),S(Te,"CanvasRenderer",St),S(Te,"SVGRenderer",Pd),S(Te,"WebGLRenderer",Vd),S(Te,"Commands",ne),S(Te,"Utils",M0);var Nn=Te;function I0(){const n=document.body.getBoundingClientRect(),e=this.width=n.width,i=this.height=n.height;this.renderer.setSize(e,i,this.ratio)}function A0(){const n=this.renderer.domElement.parentElement;if(!n){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const e=n.getBoundingClientRect(),i=this.width=e.width,r=this.height=e.height;this.renderer.setSize(i,r,this.ratio)}function O0(n,e){this.width=n,this.height=e,this.trigger(ee.Types.resize,n,e)}var Fr=Gt.getRequestAnimationFrame();function Md(){for(let n=0;n<Nn.Instances.length;n++){const e=Nn.Instances[n];e.playing&&e.update()}Nn.NextFrameId=Fr(Md)}Fr.init=function(){Md(),Fr.init=function(){}};let Tn;typeof window<"u"?Tn=window:typeof global<"u"?Tn=global:typeof self<"u"&&(Tn=self);let Id;const Zt=Math.PI*2,yt=Math.PI*.5;function z0(n,e,i,r,o,s){let a;return arguments.length<=1?(a=n.a,e=n.b,i=n.c,r=n.d,o=n.e,s=n.f):a=n,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function D0(n){Id=n}function L0(n,e){e=e&&e.identity()||new Id;let i=n;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function jt(n,e,i){return i*(e-n)+n}function qt(n,e){for(;n<0;)n+=e;return n%e}const Ad=Tn.Float32Array||Array,H0=Math.floor;function $n(n){return H0(n*1e6)/1e6}const fe={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};class te{constructor(){N(this,"_events",{});N(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(i)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,i!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}}N(te,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),N(te,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Od={x:{enumerable:!0,get:function(){return this._x},set:function(n){this._x!==n&&(this._x=n,this._bound&&this.dispatchEvent(te.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(n){this._y!==n&&(this._y=n,this._bound&&this.dispatchEvent(te.Types.change))}}},wt=class wt extends te{constructor(i=0,r=0){super();N(this,"_x",0);N(this,"_y",0);for(let o in Od)Object.defineProperty(this,o,Od[o]);this.x=i,this.y=r}static add(i,r){return new wt(i.x+r.x,i.y+r.y)}static sub(i,r){return new wt(i.x-r.x,i.y-r.y)}static subtract(i,r){return wt.sub(i,r)}static ratioBetween(i,r){return(i.x*r.x+i.y*r.y)/(i.length()*r.length())}static angleBetween(i,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const o=i.x-r.x,s=i.y-r.y;return Math.atan2(s,o)}static distanceBetween(i,r){return Math.sqrt(wt.distanceBetweenSquared(i,r))}static distanceBetweenSquared(i,r){const o=i.x-r.x,s=i.y-r.y;return o*o+s*s}set(i,r){return this.x=i,this.y=r,this}copy(i){return this.x=i.x,this.y=i.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new wt(this.x,this.y)}add(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x+=i,this.y+=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x+=i.x,this.y+=i.y):(this.x+=i,this.y+=r),this)}addSelf(i){return this.add.apply(this,arguments)}sub(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x-=i,this.y-=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x-=i.x,this.y-=i.y):(this.x-=i,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(i){return this.sub.apply(this,arguments)}subtractSelf(i){return this.sub.apply(this,arguments)}multiply(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x*=i,this.y*=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x*=i.x,this.y*=i.y):(this.x*=i,this.y*=r),this)}multiplySelf(i){return this.multiply.apply(this,arguments)}multiplyScalar(i){return this.multiply(i)}divide(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x/=i,this.y/=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x/=i.x,this.y/=i.y):(this.x/=i,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(i){return this.divide.apply(this,arguments)}divideScalar(i){return this.divide(i)}negate(){return this.multiply(-1)}dot(i){return this.x*i.x+this.y*i.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(i){return Math.sqrt(this.distanceToSquared(i))}distanceToSquared(i){const r=this.x-i.x,o=this.y-i.y;return r*r+o*o}setLength(i){return this.normalize().multiplyScalar(i)}equals(i,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(i)<r}lerp(i,r){const o=(i.x-this.x)*r+this.x,s=(i.y-this.y)*r+this.y;return this.set(o,s)}isZero(i){return i=typeof i>"u"?1e-4:i,this.length()<i}toString(){return this.x+", "+this.y}toObject(){return{x:$n(this.x),y:$n(this.y)}}rotate(i){const r=this.x,o=this.y,s=Math.cos(i),a=Math.sin(i);return this.x=r*s-o*a,this.y=r*a+o*s,this}};N(wt,"zero",new wt),N(wt,"left",new wt(-1,0)),N(wt,"right",new wt(1,0)),N(wt,"up",new wt(0,-1)),N(wt,"down",new wt(0,1));let ge=wt;class Ie extends ge{constructor(i=0,r=0,o=0,s=0,a=0,l=0,c=fe.move){super(i,r);N(this,"controls",{left:new ge,right:new ge});N(this,"_command",fe.move);N(this,"_relative",!0);N(this,"_rx",0);N(this,"_ry",0);N(this,"_xAxisRotation",0);N(this,"_largeArcFlag",0);N(this,"_sweepFlag",1);for(let u in zd)Object.defineProperty(this,u,zd[u]);this.command=c,this.relative=!0;const d=Ie.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(te.Types.change,d),this.controls.right.set(a,l).addEventListener(te.Types.change,d)}static makeBroadcast(i){return r;function r(){i._bound&&i.dispatchEvent(te.Types.change)}}static fromObject(i){return new Ie().copy(i)}copy(i){return this.x=i.x,this.y=i.y,typeof i.command=="string"&&(this.command=i.command),i.controls&&(i.controls.left&&this.controls.left.copy(i.controls.left),i.controls.right&&this.controls.right.copy(i.controls.right)),typeof i.relative=="boolean"&&(this.relative=i.relative),typeof i.rx=="number"&&(this.rx=i.rx),typeof i.ry=="number"&&(this.ry=i.ry),typeof i.xAxisRotation=="number"&&(this.xAxisRotation=i.xAxisRotation),typeof i.largeArcFlag=="number"&&(this.largeArcFlag=i.largeArcFlag),typeof i.sweepFlag=="number"&&(this.sweepFlag=i.sweepFlag),this}clone(){return new Ie().copy(this)}toObject(){return{x:$n(this.x),y:$n(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:$n(this.rx),ry:$n(this.ry),xAxisRotation:$n(this.xAxisRotation),largeArcFlag:$n(this.largeArcFlag),sweepFlag:$n(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const zd={command:{enumerable:!0,get:function(){return this._command},set:function(n){this._command!==n&&(this._command=n,this._bound&&this.dispatchEvent(te.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(n){this._relative!==!!n&&(this._relative=!!n,this._bound&&this.dispatchEvent(te.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(n){this._rx!==n&&(this._rx=n,this._bound&&this.dispatchEvent(te.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(n){this._ry!==n&&(this._ry=n,this._bound&&this.dispatchEvent(te.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(n){this._xAxisRotation!==n&&(this._xAxisRotation=n,this._bound&&this.dispatchEvent(te.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(n){this._largeArcFlag!==n&&(this._largeArcFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(n){this._sweepFlag!==n&&(this._sweepFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}}};let W0=0;const Fo={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return W0++}},Vo={RecursionLimit:16,abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Mo(n,e,i,r,o){const s=1-n;return s*s*s*e+3*s*s*n*i+3*s*n*n*r+n*n*n*o}function Dd(n,e,i,r,o,s,a,l,c){c=c||Vo.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ie(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Mo(h,n,i,o,a),m=Mo(h,e,r,s,l);u.push(new Ie(p,m))}return u}function j0(n,e,i,r,o,s,a,l,c){if(n===i&&e===r&&o===a&&s===l){const b=a-n,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(a-n),u=6*(n+o)-12*i,f=3*(i-n),h=9*(r-s)+3*(l-e),p=6*(e+s)-12*r,m=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+p)*b+m;return Math.sqrt(y*y+_*_)}return X0(g,0,1,c||Vo.RecursionLimit)}function q0(n,e,i,r,o,s,a,l){const c=[],d=[[],[]];let u,f,h,p,m,g,b,y;for(let v=0;v<2;++v){if(v===0?(f=6*n-12*i+6*o,u=-3*n+9*i-9*o+3*a,h=3*i-3*n):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;p=-h/f,0<p&&p<1&&c.push(p);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(m=(-f+y)/(2*u),0<m&&m<1&&c.push(m),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)p=c[_],x=1-p,d[0][_]=x*x*x*n+3*x*x*p*i+3*x*p*p*o+p*p*p*a,d[1][_]=x*x*x*e+3*x*x*p*r+3*x*p*p*s+p*p*p*l;return d[0][k]=n,d[1][k]=e,d[0][k+1]=a,d[1][k+1]=l,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function X0(n,e,i,r){let o=Vo.abscissas[r-2],s=Vo.weights[r-2],a=.5*(i-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*n(l):0;for(;c<d;){const f=a*o[c];u+=s[c++]*(n(l+f)+n(l-f))}return a*u}function Y0(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?qt(o-1,i):Math.max(o-1,0),l=e?qt(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];U0(c,d,u),d.command=o===0?fe.move:fe.curve}}function U0(n,e,i){const r=ge.angleBetween(n,e),o=ge.angleBetween(i,e);let s=ge.distanceBetween(n,e),a=ge.distanceBetween(i,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=yt:l-=yt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}let Vr=(Li=class extends te{constructor(){super();N(this,"_flagId",!1);N(this,"_flagClassName",!1);N(this,"_renderer",{});N(this,"_id",Fo.Identifier+Fo.uniqueId());N(this,"_className","");N(this,"classList",[]);for(let i in Ld)Object.defineProperty(this,i,Ld[i])}static fromObject(i){const r=new Li().copy(i);return"id"in i&&(r.id=i.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(i){return i.renderer&&typeof i.renderer.type=="string"&&(this.renderer.type=i.renderer.type),typeof i.className=="string"&&(this.className=i.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const r=this.renderer.ctx;this._renderer.texture&&(r.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(r.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const i=this._renderer.type;return this._renderer={type:i},this}},N(Li,"Properties",["renderer","id","className"]),Li);const Ld={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(n){const e=this._id;n!==this._id&&(this._id=n,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(n){this._className!==n&&(this._flagClassName=!0,this.classList=n.split(/\s+?/),this._className=n)}}};class Io extends Error{constructor(i){super();N(this,"name","Two.js");N(this,"message");this.message=i}}class K0{constructor(){N(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let Ao;const Hd={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Tn.document&&(Ao=document.createElement("a"));const Je=class Je extends Vr{constructor(i,r){super();N(this,"_flagSrc",!1);N(this,"_flagImage",!1);N(this,"_flagVideo",!1);N(this,"_flagLoaded",!1);N(this,"_flagRepeat",!1);N(this,"_flagOffset",!1);N(this,"_flagScale",!1);N(this,"_src","");N(this,"_image",null);N(this,"_loaded",!1);N(this,"_repeat","no-repeat");N(this,"_scale",1);N(this,"_offset",null);for(let o in Wd)Object.defineProperty(this,o,Wd[o]);if(this._renderer.type="texture",this._renderer.flagOffset=G0.bind(this),this._renderer.flagScale=Z0.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new ge,typeof r=="function"){const o=(function(){this.unbind(te.Types.load,o),typeof r=="function"&&r()}).bind(this);this.bind(te.Types.load,o)}if(typeof i=="string")this.src=i;else if(typeof i=="object"){const o=Object.prototype.toString.call(i);(o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"||o==="[object HTMLVideoElement]"||o==="[object Image]")&&(this.image=i)}this._update()}fromObject(i){const r=new Je().copy(i);return"id"in i&&(r.id=i.id),r}static getAbsoluteURL(i){return Ao?(Ao.href=i,Ao.href):i}static loadHeadlessBuffer(i,r){i.image.onload=r,i.image.src=i.src}static getTag(i){return i&&i.nodeName&&i.nodeName.toLowerCase()||"img"}static getImage(i){const r=Je.getAbsoluteURL(i);if(Je.ImageRegistry.contains(r))return Je.ImageRegistry.get(r);let o;return Tn.document?Hd.video.test(r)?o=document.createElement("video"):o=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),o.crossOrigin="anonymous",o.referrerPolicy="no-referrer",o}static load(i,r){let o=i.image,s=Je.getTag(o);i._flagImage&&(/canvas/i.test(s)?Je.Register.canvas(i,r):(i._src=o.getAttribute("two-src")||o.src,Je.Register[s](i,r))),i._flagSrc&&(o||(o=Je.getImage(i.src),i.image=o),s=Je.getTag(o),Je.Register[s](i,r))}clone(){const i=new Je(this.src);return i.repeat=this.repeat,i.offset.copy(this.offset),i.scale=this.scale,i}copy(i){return this.src=i.src,this.repeat=i.repeat,this.offset=typeof i.offset=="number"||i.offset instanceof ge?i.offset:new ge().copy(i.offset),this.scale=typeof i.scale=="number"||i.scale instanceof ge?i.scale:new ge().copy(i.scale),this}toObject(){const i=super.toObject.call(this);return i.renderer.type="texture",i.src=this.src,i.repeat=this.repeat,i.offset=this.offset.toObject(),i.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),i}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(te.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Je.load(this,(function(){this.loaded=!0,this.trigger(te.Types.change).trigger(te.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};N(Je,"Properties",["src","loaded","repeat","scale","offset","image"]),N(Je,"RegularExpressions",Hd),N(Je,"ImageRegistry",new K0),N(Je,"Register",{canvas:function(i,r){i._src="#"+i.id,Je.ImageRegistry.add(i.src,i.image),typeof r=="function"&&r()},img:function(i,r){const o=i.image,s=function(l){o.removeEventListener&&typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),new Io("unable to load "+i.src)};typeof o.width=="number"&&o.width>0&&typeof o.height=="number"&&o.height>0?s():typeof o.addEventListener=="function"&&(o.addEventListener("load",s,!1),o.addEventListener("error",a,!1)),i._src=Je.getAbsoluteURL(i._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",i.src),Je.ImageRegistry.add(i.src,o),i.image.src=i.src)},video:function(i,r){const o=function(a){i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),i.image.width=i.image.videoWidth,i.image.height=i.image.videoHeight,typeof r=="function"&&r()},s=function(a){throw i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),new Io("unable to load "+i.src)};i._src=Je.getAbsoluteURL(i._src),i.image.getAttribute("two-src")||(i.image.setAttribute("two-src",i.src),Je.ImageRegistry.add(i.src,i.image)),i.image.readyState>=4?o():(i.image.addEventListener("canplaythrough",o,!1),i.image.addEventListener("error",s,!1),i.image.src=i.src,i.image.load())}});let Qe=Je;const Wd={src:{enumerable:!0,get:function(){return this._src},set:function(n){this._src=n,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(n){this._loaded=n,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(n){this._repeat=n,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(n){const e=Qe.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}Qe.ImageRegistry.contains(i)?this._image=Qe.ImageRegistry.get(n.src):this._image=n,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset&&this._offset.unbind(te.Types.change,this._renderer.flagOffset),this._offset=n,this._offset.bind(te.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ge&&this._scale.unbind(te.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof ge&&this._scale.bind(te.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function G0(){this._flagOffset=!0}function Z0(){this._flagScale=!0}class Si extends Array{constructor(){super();Il(this,xt,new te);arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return Dt(this,xt)}set _events(i){Cm(this,xt,i)}get _bound(){return Dt(this,xt)._bound}set _bound(i){Dt(this,xt)._bound=i}addEventListener(){var i;return(i=Dt(this,xt).addEventListener)==null?void 0:i.apply(this,arguments)}on(){var i;return(i=Dt(this,xt).on)==null?void 0:i.apply(this,arguments)}bind(){var i;return(i=Dt(this,xt).bind)==null?void 0:i.apply(this,arguments)}removeEventListener(){var i;return(i=Dt(this,xt).removeEventListener)==null?void 0:i.apply(this,arguments)}off(){var i;return(i=Dt(this,xt).off)==null?void 0:i.apply(this,arguments)}unbind(){var i;return(i=Dt(this,xt).unbind)==null?void 0:i.apply(this,arguments)}dispatchEvent(){var i;return(i=Dt(this,xt).dispatchEvent)==null?void 0:i.apply(this,arguments)}trigger(){var i;return(i=Dt(this,xt).trigger)==null?void 0:i.apply(this,arguments)}listen(){var i;return(i=Dt(this,xt).listen)==null?void 0:i.apply(this,arguments)}ignore(){var i;return(i=Dt(this,xt).ignore)==null?void 0:i.apply(this,arguments)}pop(){const i=super.pop.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}shift(){const i=super.shift.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}push(){const i=super.push.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}unshift(){const i=super.unshift.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}splice(){const i=super.splice.apply(this,arguments);if(this.trigger(te.Types.remove,i),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(te.Types.insert,r),this.trigger(te.Types.order)}return i}sort(){return super.sort.apply(this,arguments),this.trigger(te.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(te.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(i,r){const o=[];for(let s=0;s<this.length;s++){const a=this[s];let l;r?l=i.call(r,a,s):l=i(a,s),o.push(l)}return o}}xt=new WeakMap;const jd=Array.prototype.slice;function Q0(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}const We={isNaN:function(n){return typeof n=="number"&&n!==+n},isElement:function(n){return!!(n&&n.nodeType===1)},isObject:function(n){const e=typeof n;return e==="function"||e==="object"&&!!n},isFunction:function(n){return typeof n=="function"},extend:function(n){const e=jd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]=r[o]}return n},defaults:function(n){const e=jd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]===void 0&&(n[o]=r[o])}return n},each:function(n,e,i){const r=i||this,o=!Q0(n)&&Object.keys(n),s=(o||n).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,n[l],l,n)}return n},performance:Tn.performance&&Tn.performance.now?Tn.performance:Date},Ut=class Ut extends Vr{constructor(i,r,o){super();N(this,"_flagOffset",!0);N(this,"_flagOpacity",!0);N(this,"_flagColor",!0);N(this,"_offset",0);N(this,"_opacity",1);N(this,"_color","#fff");for(let s in qd)Object.defineProperty(this,s,qd[s]);this._renderer.type="stop",this.offset=typeof i=="number"?i:Ut.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Ut.Index<=0?"#fff":"#000",Ut.Index=(Ut.Index+1)%2}static fromObject(i){const r=new Ut().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Ut.Properties.length;r++){const o=Ut.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Ut;return We.each(Ut.Properties,function(o){r[o]=this[o]},this),i&&i.stops&&i.stops.push(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="stop",We.each(Ut.Properties,r=>{i[r]=this[r]},this),i}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};N(Ut,"Index",0),N(Ut,"Properties",["offset","opacity","color"]);let Bi=Ut;const qd={offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset=n,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(n){this._color=n,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Mn=class Mn extends Vr{constructor(i){super();N(this,"_flagStops",!1);N(this,"_flagSpread",!1);N(this,"_flagUnits",!1);N(this,"_spread","");N(this,"_units","");for(let r in Xd)Object.defineProperty(this,r,Xd[r]);this._renderer.type="gradient",this._renderer.flagStops=J0.bind(this),this._renderer.bindStops=e1.bind(this),this._renderer.unbindStops=t1.bind(this),this.spread="pad",this.units="objectBoundingBox",i&&(this.stops=i)}static fromObject(i){let r=i.stops;r&&r.length>0&&(r=r.map(s=>s instanceof Bi?s:new Bi().copy(s)));const o=new Mn(r).copy(i);return"id"in i&&(o.id=i.id),o}clone(i){const r=this.stops.map(s=>s.clone()),o=new Mn(r);return We.each(Mn.Properties,s=>{o[s]=this[s]},this),i&&i.add(o),o}copy(i){super.copy.call(this,i);for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];o in i&&(this[o]=i[o])}return this}toObject(){const i={stops:this.stops.map(r=>r.toObject())};return We.each(Mn.Properties,r=>{i[r]=this[r]},this),i}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};N(Mn,"Stop",Bi),N(Mn,"Properties",["spread","stops","units"]);let ft=Mn;const Xd={spread:{enumerable:!0,get:function(){return this._spread},set:function(n){this._spread=n,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(n){this._units=n,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(n){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._stops=new Si((n||[]).slice(0)),this._stops.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._stops)}}};function J0(){this._flagStops=!0}function e1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function t1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}const yi=class yi extends ft{constructor(i,r,o,s,a){super(a);N(this,"_flagEndPoints",!1);N(this,"_left",null);N(this,"_right",null);for(let l in Yd)Object.defineProperty(this,l,Yd[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=n1.bind(this),this.left=new ge,this.right=new ge,typeof i=="number"&&(this.left.x=i),typeof r=="number"&&(this.left.y=r),typeof o=="number"&&(this.right.x=o),typeof s=="number"&&(this.right.y=s)}static fromObject(i){const r=new yi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<yi.Properties.length;r++){const o=yi.Properties[r];o in i&&(this[o]=i[o]instanceof ge?i[o]:new ge().copy(i[o]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new yi(this.left._x,this.left._y,this.right._x,this.right._y,r);return We.each(ft.Properties,function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return i.left=this.left.toObject(),i.right=this.right.toObject(),i}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};N(yi,"Stop",Bi),N(yi,"Properties",["left","right"]);let Mt=yi;const Yd={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof ge&&this._left.unbind(te.Types.change,this._renderer.flagEndPoints),this._left=n,this._left.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(n){this._right instanceof ge&&this._right.unbind(te.Types.change,this._renderer.flagEndPoints),this._right=n,this._right.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function n1(){this._flagEndPoints=!0}const In=class In extends ft{constructor(i,r,o,s,a,l){super(s);N(this,"_flagRadius",!1);N(this,"_flagCenter",!1);N(this,"_flagFocal",!1);N(this,"_radius",0);N(this,"_center",null);N(this,"_focal",null);for(let c in Ud)Object.defineProperty(this,c,Ud[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=i1.bind(this),this._renderer.flagFocal=r1.bind(this),this.center=new ge,this.radius=typeof o=="number"?o:1,this.focal=new ge,typeof i=="number"&&(this.center.x=i),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(i){const r=new In().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];o in i&&(/(center|focal)i/.test(o)?this[o]=i[o]instanceof ge?i[o]:new ge().copy(i[o]):typeof i[o]=="number"&&(this[o]=i[MediaKeySystemAccess]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new In(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return We.each(ft.Properties.concat(In.Properties),function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return We.each(In.Properties,function(r){i[r]=this[r]},this),i.center=this.center.toObject(),i.focal=this.focal.toObject(),i}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};N(In,"Stop",Bi),N(In,"Properties",["center","radius","focal"]);let It=In;const Ud={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(n){this._center&&this._center.unbind(te.Types.change,this._renderer.flagCenter),this._center=n,this._center.bind(te.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(n){this._focal&&this._focal.unbind(te.Types.change,this._renderer.flagFocal),this._focal=n,this._focal.bind(te.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function i1(){this._flagCenter=!0}function r1(){this._flagFocal=!0}function Kd(n,e){if(e===0||e===1)return!0;const r=n._length*e;let o=0;for(let s=0;s<n._lengths.length;s++){const a=n._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function Oo(n,e){const i=n._length;if(e<=0)return 0;if(e>=i)return n._lengths.length-1;for(let r=0,o=0;r<n._lengths.length;r++){if(o+n._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/n._lengths[r];o+=n._lengths[r]}return-1}function Gd(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),j0(r,l,o,c,s,d,a,u,i)}function fa(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),Dd(r,l,o,c,s,d,a,u,i)}function Ni(n){switch(n.renderer.type){case"texture":return Qe.fromObject(n);case"gradient":return ft.fromObject(n);case"linear-gradient":return Mt.fromObject(n);case"radial-gradient":return It.fromObject(n)}return n}const o1=Math.cos,s1=Math.sin,Zd=Math.tan,ha=[],Ot=class Ot extends te{constructor(i,r,o,s,a,l){super();N(this,"elements",new Ad(9));N(this,"manual",!1);let c=i;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(i,r,o){if(r.length<=3){const w=i;let T,C,$;const E=r[0]||0,I=r[1]||0,R=r[2]||0;return T=w[0]*E+w[1]*I+w[2]*R,C=w[3]*E+w[4]*I+w[5]*R,$=w[6]*E+w[7]*I+w[8]*R,[T,C,$]}const s=i[0],a=i[1],l=i[2],c=i[3],d=i[4],u=i[5],f=i[6],h=i[7],p=i[8],m=r[0],g=r[1],b=r[2],y=r[3],_=r[4],k=r[5],x=r[6],v=r[7],B=r[8];return o=o||new Ad(9),o[0]=s*m+a*y+l*x,o[1]=s*g+a*_+l*v,o[2]=s*b+a*k+l*B,o[3]=c*m+d*y+u*x,o[4]=c*g+d*_+u*v,o[5]=c*b+d*k+u*B,o[6]=f*m+h*y+p*x,o[7]=f*g+h*_+p*v,o[8]=f*b+h*k+p*B,o}static fromObject(i){return new Ot().copy(i)}set(i,r,o,s,a,l,c,d,u){if(typeof r>"u"){const f=i;i=f[0],r=f[1],o=f[2],s=f[3],a=f[4],l=f[5],c=f[6],d=f[7],u=f[8]}return this.elements[0]=i,this.elements[1]=r,this.elements[2]=o,this.elements[3]=s,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=u,this.trigger(te.Types.change)}copy(i){return this.elements[0]=i.elements[0],this.elements[1]=i.elements[1],this.elements[2]=i.elements[2],this.elements[3]=i.elements[3],this.elements[4]=i.elements[4],this.elements[5]=i.elements[5],this.elements[6]=i.elements[6],this.elements[7]=i.elements[7],this.elements[8]=i.elements[8],this.manual=i.manual,this.trigger(te.Types.change)}identity(){return this.elements[0]=Ot.Identity[0],this.elements[1]=Ot.Identity[1],this.elements[2]=Ot.Identity[2],this.elements[3]=Ot.Identity[3],this.elements[4]=Ot.Identity[4],this.elements[5]=Ot.Identity[5],this.elements[6]=Ot.Identity[6],this.elements[7]=Ot.Identity[7],this.elements[8]=Ot.Identity[8],this.trigger(te.Types.change)}multiply(i,r,o,s,a,l,c,d,u){if(typeof r>"u")return this.elements[0]*=i,this.elements[1]*=i,this.elements[2]*=i,this.elements[3]*=i,this.elements[4]*=i,this.elements[5]*=i,this.elements[6]*=i,this.elements[7]*=i,this.elements[8]*=i,this.trigger(te.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){i=i||0,r=r||0,o=o||0,a=this.elements;const U=a[0]*i+a[1]*r+a[2]*o,Q=a[3]*i+a[4]*r+a[5]*o,G=a[6]*i+a[7]*r+a[8]*o;return[U,Q,G]}const f=this.elements,h=[i,r,o,s,a,l,c,d,u],p=f[0],m=f[1],g=f[2],b=f[3],y=f[4],_=f[5],k=f[6],x=f[7],v=f[8],B=h[0],w=h[1],T=h[2],C=h[3],$=h[4],E=h[5],I=h[6],R=h[7],O=h[8];return this.elements[0]=p*B+m*C+g*I,this.elements[1]=p*w+m*$+g*R,this.elements[2]=p*T+m*E+g*O,this.elements[3]=b*B+y*C+_*I,this.elements[4]=b*w+y*$+_*R,this.elements[5]=b*T+y*E+_*O,this.elements[6]=k*B+x*C+v*I,this.elements[7]=k*w+x*$+v*R,this.elements[8]=k*T+x*E+v*O,this.trigger(te.Types.change)}inverse(i){const r=this.elements;i=i||new Ot;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],f=r[7],h=r[8],p=h*c-d*f,m=-h*l+d*u,g=f*l-c*u;let b=o*p+s*m+a*g;return b?(b=1/b,i.elements[0]=p*b,i.elements[1]=(-h*s+a*f)*b,i.elements[2]=(d*s-a*c)*b,i.elements[3]=m*b,i.elements[4]=(h*o-a*u)*b,i.elements[5]=(-d*o+a*l)*b,i.elements[6]=g*b,i.elements[7]=(-f*o+s*u)*b,i.elements[8]=(c*o-s*l)*b,i):null}scale(i,r){return arguments.length<=1&&(r=i),this.multiply(i,0,0,0,r,0,0,0,1)}rotate(i){const r=o1(i),o=s1(i);return this.multiply(r,-o,0,o,r,0,0,0,1)}translate(i,r){return this.multiply(1,0,i,0,1,r,0,0,1)}skewX(i){const r=Zd(i);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(i){const r=Zd(i);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(i){return ha.length=0,this.toTransformArray(i,ha),ha.map($n).join(" ")}toTransformArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=d,r[2]=h,r[3]=l,r[4]=u,r[5]=p,r[6]=c,r[7]=f,r[8]=m;return}return[a,d,h,l,u,p,c,f,m]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=f;return}return[a,d,l,u,c,f]}toArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f,r[6]=h,r[7]=p,r[8]=m;return}return[a,l,c,d,u,f,h,p,m]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f;return}return[a,l,c,d,u,f]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ot().copy(this)}};N(Ot,"Identity",[1,0,0,0,1,0,0,0,1]);let or=Ot;D0(or);const eo=class eo extends Vr{constructor(){super();N(this,"_flagMatrix",!0);N(this,"_flagScale",!1);N(this,"_matrix",null);N(this,"_worldMatrix",null);N(this,"_position",null);N(this,"_rotation",0);N(this,"_scale",1);N(this,"_skewX",0);N(this,"_skewY",0);for(let i in zo)Object.defineProperty(this,i,zo[i]);this._renderer.flagMatrix=Qd.bind(this),this.isShape=!0,this.matrix=new or,this.worldMatrix=new or,this.position=new ge,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(i){const r=new eo().copy(i);return"id"in i&&(r.id=i.id),r}get renderer(){return this._renderer}set renderer(i){this._renderer=i}get translation(){return zo.position.get.apply(this,arguments)}set translation(i){zo.position.set.apply(this,arguments)}addTo(i){return i.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&"visible"in this&&this.visible===!1||!a&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();return c?i>=c.left-l&&i<=c.right+l&&r>=c.top-l&&r<=c.bottom+l:!1}copy(i){return super.copy.call(this,i),"position"in i&&(i.position instanceof ge?this.position=i.position:this.position.copy(i.position)),"rotation"in i&&(this.rotation=i.rotation),"scale"in i&&(this.scale=typeof i.scale=="number"||i.scale instanceof ge?i.scale:new ge(i.scale.x,i.scale.y)),"skewX"in i&&(this.skewX=i.skewX),"skewY"in i&&(this.skewY=i.skewY),"matrix"in i&&i.matrix.manual&&(this.matrix.copy(i.matrix),this.matrix.manual=!0),this}clone(i){const r=new eo;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer={type:"shape"},i.isShape=!0,i.translation=this.translation.toObject(),i.rotation=this.translation.rotation,i.scale=this.scale instanceof ge?this.scale.toObject():this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.matrix=this.matrix.toObject(),i}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(i){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof ge?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),i&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};N(eo,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let En=eo;const zo={position:{enumerable:!0,get:function(){return this._position},set:function(n){this._position&&this._position.unbind(te.Types.change,this._renderer.flagMatrix),this._position=n,this._position.bind(te.Types.change,this._renderer.flagMatrix),Qd.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(n){this._rotation=n,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ge&&this._scale.unbind(te.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof ge&&this._scale.bind(te.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(n){this._skewX=n,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(n){this._skewY=n,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(n){this._matrix=n,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return L0(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function Qd(){this._flagMatrix=!0}const Jd=/^(?:none|transparent)$/i,a1=8,ma=Number.EPSILON;function jn(n,e){return{x:n,y:e}}function Do(n,e,i=ma){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function eu(n,e,i,r){const o=n*i+e*r,s=Math.sqrt(n*n+e*e)*Math.sqrt(i*i+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return n*r-e*i<0&&(a=-a),a}function l1(n,e,i){if(!n)return[jn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[jn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=n.x,d=n.y,u=e.x,f=e.y,h=(c-u)/2,p=(d-f)/2,m=Math.cos(s),g=Math.sin(s);let b=m*h+g*p,y=-g*h+m*p,_=r*r,k=o*o;const x=b*b/_+y*y/k;if(x>1){const D=Math.sqrt(x);r*=D,o*=D,_=r*r,k=o*o}const v=_*y*y+k*b*b,B=v===0?0:(_*k-v)/v;let w=Math.sqrt(Math.max(0,B));a===l&&(w=-w);const T=w*r*y/o,C=-w*o*b/r,$=m*T-g*C+(c+u)/2,E=g*T+m*C+(d+f)/2,I=eu(1,0,(b-T)/r,(y-C)/o),R=eu((b-T)/r,(y-C)/o,(-b-T)/r,(-y-C)/o)%Zt,O=I+R,U=l===0,Q=(()=>{const D=O-I,L=Math.abs(D)<Number.EPSILON;let z=qt(D,Zt);return z<Number.EPSILON&&(z=L?0:Zt),U&&!L&&(z=z===Zt?-Zt:z-Zt),z})(),G=Math.max(Fo.Resolution,Math.max(i*2,1)),W=[];for(let D=1;D<=G;D++){const L=D/G,z=I+L*Q;let P=$+r*Math.cos(z),q=E+o*Math.sin(z);if(s!==0){const K=P-$,J=q-E,Y=Math.cos(s),V=Math.sin(s);P=K*Y-J*V+$,q=K*V+J*Y+E}W.push(jn(P,q))}return W}function c1(n,e=a1){const i=[],r=[],o=n._renderer&&n._renderer.vertices&&n._renderer.vertices.length>0?n._renderer.vertices:n.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(h=!1)=>{if(a){if(h&&l&&c&&!Do(l,c)){const p=jn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&Do(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}Do(c,h)||(r.push({a:c,b:h}),a&&a.push(h),c=h)};for(let h=0;h<o.length;h++){const p=o[h],m=p.command||(h===0?fe.move:fe.line);if(m===fe.move){u(!1);const g=jn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===fe.line)f(jn(p.x,p.y));else if(m===fe.curve){const g=fa(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(jn(y.x,y.y))}f(jn(p.x,p.y))}else if(m===fe.arc){const g=l1(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===fe.close){u(!0),d=p;continue}else f(jn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!Do(l,c);u(h)}return{polygons:i,segments:r}}function d1(n,e,i){let r=!1;for(let o=0;o<n.length;o++){const s=n[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function u1(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<ma&&Math.abs(s)<ma){const h=n-i.x,p=e-i.y;return h*h+p*p}const a=((n-i.x)*o+(e-i.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=i.x+l*o,d=i.y+l*s,u=n-c,f=e-d;return u*u+f*f}function f1(n,e,i){if(!n||n.length===0)return 1/0;let r=1/0;for(let o=0;o<n.length;o++){const s=n[o],a=u1(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function h1(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!Jd.test(i):!0}function m1(n,e){const i=typeof n.linewidth=="number"?n.linewidth:n._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=n.stroke;return!r&&r!==0?!1:typeof r=="string"?!Jd.test(r):!0}function p1(n,e,i,r=0){if(!n)return!1;const o=n.left-r,s=n.right+r,a=n.top-r,l=n.bottom+r;return e>=o&&e<=s&&i>=a&&i<=l}const Lo=Number.EPSILON;function Ho(n){return typeof n.relative!="boolean"||!!n.relative}function gn(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<Lo&&Math.abs(r)<Lo){Ho(n)?o[e].clear():o[e].set(n.x,n.y);return}Ho(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Xt(n,e){gn(n,e,0,0)}function g1(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:Ho(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function sr(n,e){const i=g1(n,e);return Math.abs(i.x)>Lo||Math.abs(i.y)>Lo}function Wo(n){n.command===fe.move||n.command===fe.close||(n.command=sr(n,"left")||sr(n,"right")?fe.curve:fe.line)}function tu(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function y1(n,e){return sr(e,"right")||sr(n,"left")||sr(n,"right")||sr(e,"left")||n.command===fe.curve||e.command===fe.curve}function ar(n,e,i){return{x:jt(n.x,e.x,i),y:jt(n.y,e.y,i)}}function nu(n,e){const i=n.controls&&n.controls[e];return i?Ho(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function b1(n,e,i){const r=n.controls&&n.controls.right,o=e.controls&&e.controls.left,s={x:n.x,y:n.y},a=r?nu(n,"right"):{...s},l={x:e.x,y:e.y},c=o?nu(e,"left"):{...l},d=ar(s,a,i),u=ar(a,c,i),f=ar(c,l,i),h=ar(d,u,i),p=ar(u,f,i),m=ar(h,p,i),g=new Ie(m.x,m.y);return tu(g,n),gn(g,"left",h.x-m.x,h.y-m.y),gn(g,"right",p.x-m.x,p.y-m.y),g.command=fe.curve,{anchor:g,startOut:d,endIn:f}}function _1(n,e,i,r,o,s){const a=n.length,l=i-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,a-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let w=0,T=e-u;w<=c;w+=1,T+=1){const C=qt(T,a);h[w]=n[C]}let p=h[0].x+2*h[1].x,m=h[0].y+2*h[1].y,g=2;const b=c-1,y=[p],_=[m],k=[g],x=new Array(c+1),v=new Array(c+1);for(let w=1;w<c;w+=1){const T=w<b,C=T||s?1:2,$=T?4:s?2:7,E=T?4:s?3:8,I=T?2:s?0:1,R=C/g;g=k[w]=$-R,p=y[w]=E*h[w].x+I*h[w+1].x-R*p,m=_[w]=E*h[w].y+I*h[w+1].y-R*m}x[b]=y[b]/k[b],v[b]=_[b]/k[b];for(let w=c-2;w>=0;w-=1)x[w]=(y[w]-x[w+1])/k[w],v[w]=(_[w]-v[w+1])/k[w];x[c]=(3*h[c].x-x[b])/2,v[c]=(3*h[c].y-v[b])/2;const B=c-f;for(let w=u,T=e;w<=B;w+=1,T+=1){const C=qt(T,a),$=n[C],E=x[w]-$.x,I=v[w]-$.y;o||w<B?gn($,"right",E,I):Xt($,"right"),o||w>u?gn($,"left",-E,-I):Xt($,"left"),Wo($)}}function w1(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=ge.distanceBetween(a,l),u=ge.distanceBetween(l,c),f=r===void 0?.5:r,h=Math.pow(d,f),p=Math.pow(u,f),m=h*h,g=p*p;if(!o&&e){const b=2*g+3*p*h+m,y=3*p*(p+h);if(y!==0){const _=(g*a.x+b*l.x-m*c.x)/y-l.x,k=(g*a.y+b*l.y-m*c.y)/y-l.y;gn(n,"left",_,k)}else Xt(n,"left")}else Xt(n,"left");if(!s&&i){const b=2*m+3*h*p+g,y=3*h*(h+p);if(y!==0){const _=(m*c.x+b*l.x-g*a.x)/y-l.x,k=(m*c.y+b*l.y-g*a.y)/y-l.y;gn(n,"right",_,k)}else Xt(n,"right")}else Xt(n,"right");Wo(n)}function x1(n,e,i,r,o,s){if(!(e&&i)){e||Xt(n,"left"),i||Xt(n,"right"),Wo(n);return}const a=e,l=n,c=i,d=ge.distanceBetween(a,l),u=ge.distanceBetween(l,c),f=d+u,h=r===void 0?.4:r,p={x:a.x-c.x,y:a.y-c.y};if(!o&&f!==0){const m=h*d/f;gn(n,"left",p.x*m,p.y*m)}else Xt(n,"left");if(!s&&f!==0){const m=h*d/f-h;gn(n,"right",p.x*m,p.y*m)}else Xt(n,"right");Wo(n)}function k1(n,e,i,r,o,s){const a=s.type,l=s.factor,c=n.length;for(let d=e;d<=i;d+=1){const u=qt(d,c),f=n[u];if(f.command===fe.move){Xt(f,"left"),Xt(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[qt(h,c)],g=p===null?null:n[qt(p,c)],b=h===null,y=p===null;a==="geometric"?x1(f,m,g,l,b,y):w1(f,m,g,l,b,y)}}const lr=Math.min,cr=Math.max,C1=Math.ceil,v1=Math.floor,S1=new ge,B1=new or,_n=class _n extends En{constructor(i,r,o,s){super();N(this,"_flagVertices",!0);N(this,"_flagLength",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagCap",!0);N(this,"_flagJoin",!0);N(this,"_flagMiter",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_flagMask",!1);N(this,"_flagClip",!1);N(this,"_length",0);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_cap","round");N(this,"_join","round");N(this,"_miter",4);N(this,"_closed",!0);N(this,"_curved",!1);N(this,"_automatic",!0);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_mask",null);N(this,"_clip",!1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);for(let a in iu)Object.defineProperty(this,a,iu[a]);this._renderer.type="path",this._renderer.flagVertices=ru.bind(this),this._renderer.bindVertices=ou.bind(this),this._renderer.unbindVertices=su.bind(this),this._renderer.flagFill=au.bind(this),this._renderer.flagStroke=lu.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!r,this.curved=!!o,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=i,this.automatic=!s,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new _n().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){if(super.copy.call(this,i),i.vertices){this.vertices=[];for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ie?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ie().copy(o))}}for(let r=0;r<_n.Properties.length;r++){const o=_n.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new _n;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<_n.Properties.length;o++){const s=_n.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="path",i.vertices=this.vertices.map(r=>r.toObject()),We.each(_n.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const i=this.getBoundingClientRect(!0),r=i.width/2,o=i.height/2,s=i.left+i.width/2,a=i.top+i.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=s,c.y-=a,c.x+=r,c.y+=o}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=o),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const a=this.vertices[s];a.x-=r,a.y-=o}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getBoundingClientRect(i){let r,o,s,a,l,c,d=1/0,u=-1/0,f=1/0,h=-1/0;if(this._update(!0),r=i?this.matrix:this.worldMatrix,o=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:p,scaleY:m}=z0(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof p=="number"&&typeof m=="number"&&(o=Math.max(p,m)*(this.linewidth||0)/2)}else o*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(a=0;a<s;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+s-1)%s];const[p,m]=r.multiply(l.x,l.y),[g,b]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let y=l.controls.right.x,_=l.controls.right.y;l.relative&&(y+=l.x,_+=l.y);let[k,x]=r.multiply(y,_),v=c.controls.left.x,B=c.controls.left.y;c.relative&&(v+=c.x,B+=c.y);let[w,T]=r.multiply(v,B);const C=q0(p,m,k,x,w,T,g,b);f=lr(C.min.y-o,f),d=lr(C.min.x-o,d),u=cr(C.max.x+o,u),h=cr(C.max.y+o,h)}else a<=1&&(f=lr(m-o,f),d=lr(p-o,d),u=cr(p+o,u),h=cr(m+o,h)),f=lr(b-o,f),d=lr(g-o,d),u=cr(g+o,u),h=cr(b+o,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&this.visible===!1||!a&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();if(!c||i<c.left-l||i>c.right+l||r<c.top-l||r>c.bottom+l)return!1;const d=this.worldMatrix,u=d&&d.inverse(B1);if(!u)return super.contains(i,r,s);const[f,h]=u.multiply(i,r,1),p=typeof s.precision=="number"&&!Number.isNaN(s.precision)?Math.max(1,Math.floor(s.precision)):8,m=h1(this,s.fill),g=m1(this,s.stroke),{polygons:b,segments:y}=c1(this,p);if(m&&b.length>0&&d1(b,f,h))return!0;if(g&&y.length>0){const _=typeof this.linewidth=="number"?this.linewidth:0;if(_>0&&f1(y,f,h)<=_/2+l)return!0}return!m&&!g?super.contains(i,r,s):m&&b.length===0?super.contains(i,r,s):!1}getPointAt(i,r){let o,s,a,l,c,d,u,f,h,p,m,g,b,y,_,k=this.length*Math.min(Math.max(i,0),1);const x=this.vertices.length,v=x-1;let B=null,w=null;for(let W=0,D=this._lengths.length,L=0;W<D;W++){if(L+this._lengths[W]>=k){this._closed?(o=qt(W,x),s=qt(W-1,x),W===0&&(o=s,s=W)):(o=W,s=Math.min(Math.max(W-1,0),v)),B=this.vertices[o],w=this.vertices[s],k-=L,this._lengths[W]!==0?i=k/this._lengths[W]:i=0;break}L+=this._lengths[W]}if(B===null||w===null)return null;if(B){if(!w)return B}else return w;_=w.controls&&w.controls.right,y=B.controls&&B.controls.left,c=w.x,p=w.y,d=(_||w).x,m=(_||w).y,u=(y||B).x,g=(y||B).y,f=B.x,b=B.y,_&&w.relative&&(d+=w.x,m+=w.y),y&&B.relative&&(u+=B.x,g+=B.y),l=Mo(i,c,d,u,f),h=Mo(i,p,m,g,b);const T=jt(c,d,i),C=jt(p,m,i),$=jt(d,u,i),E=jt(m,g,i),I=jt(u,f,i),R=jt(g,b,i),O=jt(T,$,i),U=jt(C,E,i),Q=jt($,I,i),G=jt(E,R,i);return We.isObject(r)?(r.x=l,r.y=h,r instanceof Ie&&(r.controls.left.x=O,r.controls.left.y=U,r.controls.right.x=Q,r.controls.right.y=G,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=h,r.controls.right.x-=l,r.controls.right.y-=h)),r.t=i,r):(a=new Ie(l,h,O-l,U-h,Q-l,G-h,this._curved?fe.curve:fe.line),a.t=i,a)}plot(){if(this.curved)return Y0(this._collection,this.closed),this;for(let i=0;i<this._collection.length;i++)this._collection[i].command=i===0?fe.move:fe.line;return this}smooth(i){const r=i||{},o=r.type||"continuous",s=this._collection,a=s.length;if(a<2)return this;const l=this._closed||a>0&&s[a-1]&&s[a-1].command===fe.close,c=(p,m)=>{if(p==null)return m;if(typeof p=="number"){if(l)return qt(p,a);let b=p;return b<0&&(b+=a),Math.min(Math.max(b,0),a-1)}const g=s.indexOf(p);return g!==-1?g:m},d=l&&r.from===void 0&&r.to===void 0;let u=c(r.from,0),f=c(r.to,a-1);if(u>f)if(l)u-=a;else{const p=u;u=f,f=p}const h=f-u+1;for(let p=0;p<h;p+=1){const m=qt(u+p,a),g=s[m],b=!l&&m===0;g.command===fe.move&&!b&&(g.command=fe.line)}if(o==="continuous"||o==="asymmetric")_1(s,u,f,l,d,o==="asymmetric");else if(o==="catmull-rom"||o==="geometric"){const p={type:o,factor:r.factor};k1(s,u,f,l,d,p)}else throw new Error(`Path.smooth does not support type "${o}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(i){this._update();const r=this.vertices,o=r.length;if(o<2)return this;const s=[];let a=null,l=null;for(let c=0;c<o;c+=1){const d=r[c];if(!a||d.command===fe.move){const f=d.clone();s.push(f),a=d,l=d;continue}if(y1(d,a)){const h=fa(d,a,i).length,p=s[s.length-1];let m=p.clone(),g=d.clone(),b=p,y=0;if(h<=1){const _=d.clone();s.push(_)}else{for(let k=1;k<h;k+=1){const x=k/h,v=1-y,B=v<=Number.EPSILON?x:(x-y)/v,w=b1(m,g,B);gn(b,"right",w.startOut.x-b.x,w.startOut.y-b.y);const T=w.anchor;s.push(T),b=T,m=T.clone(),y=x,gn(g,"left",w.endIn.x-g.x,w.endIn.y-g.y)}const _=d.clone();_.controls.left.copy(g.controls.left),s.push(_)}}else{const f=fa(d,a,i);for(let p=1;p<f.length;p+=1){const m=f[p];tu(m,a),Xt(m,"left"),Xt(m,"right"),m.command=fe.line,s.push(m)}const h=d.clone();s.push(h)}a=d,d.command===fe.close&&(a=l)}return this._automatic=!1,this._curved=!1,this.vertices=s,this}_updateLength(i,r){r||this._update();const s=this.vertices.length-1;let a=this.vertices[s],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),We.each(this.vertices,function(c,d){if(d<=0||c.command===fe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=Gd(c,a,i),l+=this._lengths[d],a=c},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const i=this._collection.length,r=this._closed,o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=Oo(this,o*this._length),l=Oo(this,s*this._length),c=C1(a),d=v1(l);let u,f,h,p,m,g;for(this._renderer.vertices.length=0,g=0;g<i;g++)this._renderer.collection.length<=g&&this._renderer.collection.push(new Ie),g>d&&!f?(m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(s,m),m.command=this._renderer.collection[g].command,this._renderer.vertices.push(m),f=m,h=this._collection[g-1],h&&h.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),h.relative?this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(ge.zero,1-m.t):this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(h,1-m.t))):g>=c&&g<=d&&(m=this._renderer.collection[g].copy(this._collection[g]),this._renderer.vertices.push(m),g===d&&Kd(this,s)?(f=m,!r&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):g===c&&Kd(this,o)&&(u=m,u.command=fe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(g=c-1,m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(o,m),m.command=fe.move,this._renderer.vertices.unshift(m),p=this._collection[g+1],p&&p.controls&&(m.controls.left.clear(),p.relative?this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(ge.zero,m.t):(S1.copy(p),this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(p,m.t))))}return En.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,En.prototype.flagReset.call(this),this}};N(_n,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),N(_n,"Utils",{getCurveLength:Gd});let Ae=_n;const iu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=!!n,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=!!n,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){if(n===this._automatic)return;this._automatic=!!n;const e=this._automatic?"ignore":"listen";We.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Si?this._collection=n:this._collection=new Si(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function ru(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function ou(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function su(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function au(){this._flagFill=!0}function lu(){this._flagStroke=!0}const N1=Math.ceil,T1=Math.floor,An=class An extends En{constructor(i){super();N(this,"_flagVertices",!0);N(this,"_flagLength",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagSize",!0);N(this,"_flagSizeAttenuation",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_length",0);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_size",1);N(this,"_sizeAttenuation",!1);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);N(this,"noFill",Ae.prototype.noFill);N(this,"noStroke",Ae.prototype.noStroke);N(this,"corner",Ae.prototype.corner);N(this,"center",Ae.prototype.center);N(this,"getBoundingClientRect",Ae.prototype.getBoundingClientRect);N(this,"_updateLength",Ae.prototype._updateLength);for(let r in cu)Object.defineProperty(this,r,cu[r]);this._renderer.type="points",this._renderer.flagVertices=ru.bind(this),this._renderer.bindVertices=ou.bind(this),this._renderer.unbindVertices=su.bind(this),this._renderer.flagFill=au.bind(this),this._renderer.flagStroke=lu.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=i,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new An().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ie?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ie().copy(o))}for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new An;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<An.Properties.length;o++){const s=An.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="points",i.vertices=this.vertices.map(r=>r.toObject()),We.each(An.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(i){this._update();let r=[];for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o],a=this.vertices[o-1];if(!a)continue;const l=s.x,c=s.y,d=a.x,u=a.y,f=Dd(l,c,l,c,d,u,d,u,i);r=r.concat(f)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const i=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),o=Oo(this,i*this._length),s=Oo(this,r*this._length),a=N1(o),l=T1(s);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let u=0;u<this._collection.length;u++)u>=a&&u<=l&&(d=this._collection[u],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};N(An,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let jo=An;const cu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(n){this._sizeAttenuation=n,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Si?this._collection=n:this._collection=new Si(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};class du extends Si{constructor(i){i=Array.isArray(i)?i:Array.prototype.slice.call(arguments);super(i);Il(this,ys,{});this.attach(i),this.on(te.Types.insert,this.attach),this.on(te.Types.remove,this.detach)}get ids(){return Dt(this,ys)}attach(i){for(let r=0;r<i.length;r++){const o=i[r];o&&o.id&&(this.ids[o.id]=o)}return this}detach(i){for(let r=0;r<i.length;r++)delete this.ids[i[r].id];return this}}ys=new WeakMap;const Kn=class Kn extends Ae{constructor(i,r,o,s,a,l,c){const d=c||Fo.Resolution*3,u=[];for(let f=0;f<d;f++)u.push(new Ie);super(u,!0,!1,!0);N(this,"_flagStartAngle",!1);N(this,"_flagEndAngle",!1);N(this,"_flagInnerRadius",!1);N(this,"_flagOuterRadius",!1);N(this,"_startAngle",0);N(this,"_endAngle",Zt);N(this,"_innerRadius",0);N(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let f in uu)Object.defineProperty(this,f,uu[f]);typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Kn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Kn.Properties.length;r++){const o=Kn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const i=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=qt(i,Zt)===qt(r,Zt),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,f=0,h,p,m,g,b,y,_,k,x;for(a?d--:l||(d-=2),h=0,p=d-1;h<d;h++){switch(m=h/p,g=c[f],b=m*(r-i)+i,y=(r-i)/d,_=s*Math.cos(b),k=s*Math.sin(b),h){case 0:u=fe.move;break;default:u=fe.curve}g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===fe.curve&&(x=s*y/Math.PI,g.controls.left.x=x*Math.cos(b-yt),g.controls.left.y=x*Math.sin(b-yt),g.controls.right.x=x*Math.cos(b+yt),g.controls.right.y=x*Math.sin(b+yt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++}if(l){for(a?(c[f].command=fe.close,f++):(d--,p=d-1),h=0;h<d;h++)m=h/p,g=c[f],b=(1-m)*(r-i)+i,y=(r-i)/d,_=o*Math.cos(b),k=o*Math.sin(b),u=fe.curve,h<=0&&(u=a?fe.move:fe.line),g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===fe.curve&&(x=o*y/Math.PI,g.controls.left.x=x*Math.cos(b+yt),g.controls.left.y=x*Math.sin(b+yt),g.controls.right.x=x*Math.cos(b-yt),g.controls.right.y=x*Math.sin(b-yt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++;c[f].copy(c[0]),c[f].command=fe.line}else a||(c[f].command=fe.line,c[f].x=0,c[f].y=0,f++,c[f].copy(c[0]),c[f].command=fe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Kn(0,0,r,o,s,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Ae.Properties.length;d++){const u=Ae.Properties[d];c[u]=this[u]}return i&&i.add(c),c}toObject(){const i=super.toObject.call(this);i.renderer.type="arc-segment";for(let r=0;r<Kn.Properties.length;r++){const o=Kn.Properties[r];i[o]=this[o]}return i}};N(Kn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let pa=Kn;const uu={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(n){this._startAngle=n,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(n){this._endAngle=n,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}}},ga=Math.cos,ya=Math.sin,Gn=class Gn extends Ae{constructor(i,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ie(0,0,0,0,0,0));super(l,!0,!0,!0);N(this,"_flagRadius",!1);N(this,"_radius",0);this._renderer.type="circle";for(let c in fu)Object.defineProperty(this,c,fu[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Gn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Gn.Properties.length;r++){const o=Gn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagRadius){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(i*2)),o=this._radius,s=o*r;for(let a=0;a<this.vertices.length;a++){const c=a/i*Zt,d=o*ga(c),u=o*ya(c),f=s*ga(c-yt),h=s*ya(c-yt),p=s*ga(c+yt),m=s*ya(c+yt),g=this.vertices[a];g.command=a===0?fe.move:fe.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(i){const r=new Gn(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="circle";for(let r=0;r<Gn.Properties.length;r++){const o=Gn.Properties[r];i[o]=this[o]}return i}};N(Gn,"Properties",["radius"]);let ba=Gn;const fu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},_a=Math.cos,wa=Math.sin,Zn=class Zn extends Ae{constructor(i,r,o,s,a){typeof s!="number"&&typeof o=="number"&&(s=o);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Ie);super(c,!0,!0,!0);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_width",0);N(this,"_height",0);this._renderer.type="ellipse";for(let d in hu)Object.defineProperty(this,d,hu[d]);typeof o=="number"&&(this.width=o*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Zn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Zn.Properties.length;r++){const o=Zn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),o=this._width/2,s=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/i*Zt,d=o*_a(c),u=s*wa(c),f=o*r*_a(c-yt),h=s*r*wa(c-yt),p=o*r*_a(c+yt),m=s*r*wa(c+yt),g=this.vertices[a];g.command=a===0?fe.move:fe.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new Zn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="ellipse";for(let r=0;r<Zn.Properties.length;r++){const o=Zn.Properties[r];i[o]=this[o]}return i}};N(Zn,"Properties",["width","height"]);let xa=Zn;const hu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}}},$1=Math.cos,E1=Math.sin,Qn=class Qn extends Ae{constructor(i,r,o,s){s=Math.max(s||0,3);super();N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_flagSides",!1);N(this,"_radius",0);N(this,"_width",0);N(this,"_height",0);N(this,"_sides",0);this._renderer.type="polygon";for(let a in mu)Object.defineProperty(this,a,mu[a]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.radius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Qn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const i=this._sides,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=Zt*a+Math.PI/2,c=this._width*$1(l)/2,d=this._height*E1(l)/2;s>=o?this.vertices.push(new Ie(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?fe.move:fe.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=new Qn(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="polygon";for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];i[o]=this[o]}return i}};N(Qn,"Properties",["width","height","sides"]);let ka=Qn;const mu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this.width=n*2,this.height=n*2}},width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},Hi=class Hi extends Ae{constructor(i,r,o,s){const a=[new Ie,new Ie,new Ie,new Ie];super(a,!0,!1,!0);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_width",0);N(this,"_height",0);N(this,"_origin",null);this._renderer.type="rectangle";for(let l in pu)Object.defineProperty(this,l,pu[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new ge,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(i){const r=new Hi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Hi.Properties.length;r++){const o=Hi.Properties[r];o in i&&(typeof i[o]=="number"?this[o]=i[o]:this[o]instanceof ge&&this[o].copy(i[o]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const i=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ie),this.vertices[0].set(-i,-r).sub(this._origin).command=fe.move,this.vertices[1].set(i,-r).sub(this._origin).command=fe.line,this.vertices[2].set(i,r).sub(this._origin).command=fe.line,this.vertices[3].set(-i,r).sub(this._origin).command=fe.line,this.vertices[4]&&(this.vertices[4].set(-i,-r).sub(this._origin).command=fe.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=new Hi(0,0,this.width,this.height);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]instanceof ge?r[s].copy(this[s]):r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="rectangle",i.width=this.width,i.height=this.height,i.origin=this.origin.toObject(),i}};N(Hi,"Properties",["width","height","origin"]);let Mr=Hi;const pu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(n){this._origin&&this._origin.unbind(te.Types.change,this._renderer.flagVertices),this._origin=n,this._origin.bind(te.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Jn=class Jn extends Ae{constructor(i,r,o,s,a){typeof a>"u"&&typeof o=="number"&&typeof s=="number"&&(a=Math.floor(Math.min(o,s)/12));const l=[];for(let c=0;c<10;c++)l.push(new Ie(0,0,0,0,0,0,c===0?fe.move:fe.curve));super(l);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_flagRadius",!1);N(this,"_width",0);N(this,"_height",0);N(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in gu)Object.defineProperty(this,c,gu[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=R1.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof ge)&&(this.radius=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Jn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];if(o in i){const s=i[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof ge?s:new ge().copy(s):typeof s=="number"&&(this[o]=s)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const i=this._width,r=this._height;let o,s;this._radius instanceof ge?(o=this._radius.x,s=this._radius.y):(o=this._radius,s=this._radius);let a,l=i/2,c=r/2;a=this.vertices[0],a.x=-(l-o),a.y=-c,a=this.vertices[1],a.x=l-o,a.y=-c,a.controls.left.clear(),a.controls.right.x=o,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-s),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-s,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=s,a=this.vertices[4],a.x=l-o,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-o),a.y=c,a.controls.left.clear(),a.controls.right.x=-o,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-s,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-s),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-s,a=this.vertices[8],a.x=-(l-o),a.y=-c,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[9],a.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(i){const r=this.width,o=this.height,s=this.radius,a=new Jn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="rounded-rectangle";for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];i[o]=this[o]}return i.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),i}};N(Jn,"Properties",["width","height","radius"]);let Ca=Jn;const gu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius instanceof ge&&this._radius.unbind(te.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof ge&&this._radius.bind(te.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function R1(){this._flagRadius=!0}const P1=Math.cos,F1=Math.sin,ei=class ei extends Ae{constructor(i,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();N(this,"_flagInnerRadius",!1);N(this,"_flagOuterRadius",!1);N(this,"_flagSides",!1);N(this,"_innerRadius",0);N(this,"_outerRadius",0);N(this,"_sides",0);this._renderer.type="star";for(let l in yu)Object.defineProperty(this,l,yu[l]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.sides=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ei().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const i=this._sides*2,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=Zt*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*P1(l),u=c*F1(l);s>=o?this.vertices.push(new Ie(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?fe.move:fe.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.sides,a=new ei(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="star";for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];i[o]=this[o]}return i}};N(ei,"Properties",["innerRadius","outerRadius","sides"]);let va=ei;const yu={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}};let Sa;const bu=Math.min,_u=Math.max;Tn.document&&(Sa=document.createElement("canvas"));const Rt=class Rt extends En{constructor(i,r,o,s){super();N(this,"_flagValue",!0);N(this,"_flagFamily",!0);N(this,"_flagSize",!0);N(this,"_flagLeading",!0);N(this,"_flagAlignment",!0);N(this,"_flagBaseline",!0);N(this,"_flagStyle",!0);N(this,"_flagWeight",!0);N(this,"_flagDecoration",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagMask",!1);N(this,"_flagClip",!1);N(this,"_flagDirection",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_value","");N(this,"_family","sans-serif");N(this,"_size",13);N(this,"_leading",17);N(this,"_alignment","center");N(this,"_baseline","middle");N(this,"_style","normal");N(this,"_weight",500);N(this,"_decoration","none");N(this,"_direction","ltr");N(this,"_fill","#000");N(this,"_stroke","none");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_mask",null);N(this,"_clip",!1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);for(let a in wu)Object.defineProperty(this,a,wu[a]);if(this._renderer.type="text",this._renderer.flagFill=V1.bind(this),this._renderer.flagStroke=M1.bind(this),this.value=i,typeof r=="number"&&(this.translation.x=r),typeof o=="number"&&(this.translation.y=o),this.dashes=[],this.dashes.offset=0,!We.isObject(s))return this;for(let a=0;a<Rt.Properties.length;a++){const l=Rt.Properties[a];l in s&&(this[l]=s[l])}}static Measure(i){if(Sa){const r=Sa.getContext("2d");r.font=[i._style,i._weight,`${i._size}px/${i._leading}px`,i._family].join(" ");const o=r.measureText(i.value,0,0),s=o.actualBoundingBoxDescent+o.actualBoundingBoxAscent;return{width:o.width,height:s}}else{const r=this.value.length*this.size*Rt.Ratio,o=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:r,height:o}}}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new Rt().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<Rt.Properties.length;r++){const o=Rt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Rt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<Rt.Properties.length;o++){const s=Rt.Properties[o];r[s]=this[s]}return this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);i.renderer.type="text";for(let r=0;r<Rt.Properties.length;r++){const o=Rt.Properties[r];i[o]=this[o]}return i}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(i){let r,o,s,a,l;this._update(!0),r=i?this.matrix:this.worldMatrix;const{width:c,height:d}=Rt.Measure(this),u=(this._linewidth||0)/2;switch(this.alignment){case"left":o=-u,s=c+u;break;case"right":o=-(c+u),s=u;break;default:o=-(c/2+u),s=c/2+u}switch(this.baseline){case"middle":a=-(d/2+u),l=d/2+u;break;default:a=-(d+u),l=u}const[f,h]=r.multiply(o,a),[p,m]=r.multiply(o,l),[g,b]=r.multiply(s,a),[y,_]=r.multiply(s,l);return a=bu(h,m,b,_),o=bu(f,p,g,y),s=_u(f,p,g,y),l=_u(h,m,b,_),{top:a,left:o,right:s,bottom:l,width:s-o,height:l-a}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};N(Rt,"Ratio",.6),N(Rt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let dr=Rt;const wu={value:{enumerable:!0,get:function(){return this._value},set:function(n){this._value=n,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(n){this._family=n,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(n){this._leading=n,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(n){this._alignment=n,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(n){this._style=n,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(n){this._weight=n,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(n){this._decoration=n,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(n){this._direction=n,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(n){this._baseline=n,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function V1(){this._flagFill=!0}function M1(){this._flagStroke=!0}const ti=class ti extends Mr{constructor(i,r,o,s){super(r,o,0,0);N(this,"_flagTextures",!1);N(this,"_flagFrameRate",!1);N(this,"_flagIndex",!1);N(this,"_amount",1);N(this,"_duration",0);N(this,"_index",0);N(this,"_startTime",0);N(this,"_playing",!1);N(this,"_firstFrame",0);N(this,"_lastFrame",0);N(this,"_loop",!0);N(this,"_textures",null);N(this,"_frameRate",0);N(this,"_origin",null);this._renderer.type="image-sequence";for(let a in xu)Object.defineProperty(this,a,xu[a]);this._renderer.flagTextures=I1.bind(this),this._renderer.bindTextures=A1.bind(this),this._renderer.unbindTextures=O1.bind(this),this.noStroke(),this.noFill(),Array.isArray(i)?this.textures=i.map(ku.bind(this)):typeof i=="string"&&(this.textures=[ku(i)]),this.origin=new ge,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=ti.DefaultFrameRate,this.index=0}static fromObject(i){const r=new ti().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ti.Properties.length;r++){const o=ti.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=We.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(i){const r=new ti(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="image-sequence",i.textures=this.textures.map(function(r){return r.toObject()}),i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let i=0;i<this.textures.length;i++){const r=this.textures[i];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const i=this._textures;let r,o,s,a,l,c,d,u;return i&&(this._flagTextures&&(this._amount=i.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,We.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=We.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?s=s%l:s=Math.min(s,l),d=jt(this._firstFrame,u,s/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o),this.fill=c,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Qe))&&(c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o)),this.fill=c)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};N(ti,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),N(ti,"DefaultFrameRate",30);let Ba=ti;const xu={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(n){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._textures=new Si((n||[]).slice(0)),this._textures.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}};function I1(){this._flagTextures=!0}function A1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function O1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function ku(n){if(n instanceof Qe)return n;if(typeof n=="string")return new Qe(n)}const Wi=class Wi extends Mr{constructor(i,r,o,s,a,l){super(r,o,0,0);N(this,"_flagTexture",!1);N(this,"_flagColumns",!1);N(this,"_flagRows",!1);N(this,"_flagFrameRate",!1);N(this,"_flagIndex",!1);N(this,"_amount",1);N(this,"_duration",0);N(this,"_startTime",0);N(this,"_playing",!1);N(this,"_firstFrame",0);N(this,"_lastFrame",0);N(this,"_loop",!0);N(this,"_texture",null);N(this,"_columns",1);N(this,"_rows",1);N(this,"_frameRate",0);N(this,"_index",0);N(this,"_origin",null);this._renderer.type="sprite";for(let c in Cu)Object.defineProperty(this,c,Cu[c]);this.noStroke(),this.noFill(),i instanceof Qe?this.texture=i:typeof i=="string"&&(this.texture=new Qe(i)),this.origin=new ge,this._update(),typeof s=="number"&&(this.columns=s),typeof a=="number"&&(this.rows=a),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(i){const r=new Wi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Wi.Properties.length;r++){const o=Wi.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=We.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(i){const r=new Wi(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&r.play(this._firstFrame,this._lastFrame),r.loop=this.loop,r.firstFrame=this.firstFrame,r.lastFrame=this.lastFrame,i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="sprite",i.texture=this.texture.toObject(),i.columns=this.columns,i.rows=this.rows,i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const i=this._texture,r=this._columns,o=this._rows;let s,a,l,c,d,u,f,h,p;if(i&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=i),i.loaded)){f=i.image.width,h=i.image.height,s=f/r,a=h/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(We.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=We.performance.now()-this._startTime,p=this._lastFrame+1,d=1e3*(p-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=jt(this._firstFrame,p,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%r,g=Math.floor(this._index/r),b=-s*m+(f-s)/2,y=-a*g+(h-a)/2;b!==i.offset.x&&(i.offset.x=b),y!==i.offset.y&&(i.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};N(Wi,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Na=Wi;const Cu={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(n){this._columns=n,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(n){this._rows=n,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}},qo=Math.min,Xo=Math.max,z1={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},zt=class zt extends En{constructor(i){super();N(this,"_flagAdditions",!1);N(this,"_flagSubtractions",!1);N(this,"_flagOrder",!1);N(this,"_flagOpacity",!0);N(this,"_flagBeginning",!1);N(this,"_flagEnding",!1);N(this,"_flagLength",!1);N(this,"_flagMask",!1);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_cap","round");N(this,"_join","round");N(this,"_miter",4);N(this,"_closed",!0);N(this,"_curved",!1);N(this,"_automatic",!0);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_length",0);N(this,"_mask",null);N(this,"_strokeAttenuation",!0);for(let r in vu)Object.defineProperty(this,r,vu[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(i)?i:Array.prototype.slice.call(arguments)}static InsertChildren(i){for(let r=0;r<i.length;r++)Su.call(this,i[r],this)}static RemoveChildren(i){for(let r=0;r<i.length;r++)Su.call(this,i[r])}static OrderChildren(i){this._flagOrder=!0}static fromObject(i){const r=new zt;for(let s=0;s<zt.Properties.length;s++){const a=zt.Properties[s];a in i&&(/(fill|stroke)/i.test(a)?r[a]=typeof i[a]=="string"?i[a]:Ni(i[a]):r[a]=i[a])}return"mask"in i&&(r.mask=o(i.mask)),"id"in i&&(r.id=i.id),r.children=i.children.map(o),r;function o(s){if(s&&s.renderer)switch(s.renderer.type){case"arc-segment":return pa.fromObject(s);case"circle":return ba.fromObject(s);case"element":return Vr.fromObject(s);case"ellipse":return xa.fromObject(s);case"group":return zt.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Ba.fromObject(s);case"path":return Ae.fromObject(s);case"points":return jo.fromObject(s);case"polygon":return ka.fromObject(s);case"rectangle":return Mr.fromObject(s);case"rounded-rectangle":return Ca.fromObject(s);case"shape":return En.fromObject(s);case"sprite":return Na.fromObject(s);case"star":return va.fromObject(s);case"text":return dr.fromObject(s)}return s}}static IsVisible(i,r){if(!r)return!0;let o=i;for(;o;){if(typeof o.visible=="boolean"&&!o.visible||typeof o.opacity=="number"&&o.opacity<=0)return!1;o=o.parent}return!0}static VisitForHitTest(i,r,o,s,a,l,c){const d=i&&i.children;if(!d)return!1;const u=r.results;for(let f=d.length-1;f>=0;f--){const h=d[f];if(!h||!zt.IsVisible(h,r.visibleOnly))continue;const p=typeof h.getBoundingClientRect=="function"?h.getBoundingClientRect():null;if(!(p&&!p1(p,r.x,r.y,l))){if(h instanceof zt){if(o&&(!s||s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c)||zt.VisitForHitTest(h,r,o,s,a,l,c))return!0;continue}if(h instanceof En&&!(s&&!s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c))return!0}}return!1}copy(i){super.copy.call(this,i),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<zt.Properties.length;r++){const o=zt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new zt,o=this.children.map(function(s){return s.clone()});return r.add(o),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="group",i.children=[],i.opacity=this.opacity,i.className=this.className,i.mask=this.mask?this.mask.toObject():null,We.each(this.children,(r,o)=>{i.children[o]=r.toObject()},this),i}dispose(){if(super.dispose(),this.children)for(let i=0;i<this.children.length;i++){const r=this.children[i];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(i,r,o){const s=o||{},{results:a,hitOptions:l,context:c,single:d,empty:u}=z1.getShapesAtPoint;a.length=0;const f=s.mode==="deepest"||s.deepest?"deepest":"all",h=s.visibleOnly!==!1,p=!!s.includeGroups,m=typeof s.filter=="function"?s.filter:null,g=typeof s.tolerance=="number"?s.tolerance:0;typeof s.precision=="number"?l.precision=s.precision:delete l.precision,typeof s.fill<"u"?l.fill=s.fill:delete l.fill,typeof s.stroke<"u"?l.stroke=s.stroke:delete l.stroke,l.tolerance=g,l.ignoreVisibility=!h;const b=f==="deepest";if(c.x=i,c.y=r,c.visibleOnly=h,c.results=a,zt.VisitForHitTest(this,c,p,m,l,g,b),b){if(a.length>0){const _=a[0];return a.length=0,d[0]=_,d.length=1,d}return u.length=0,u}const y=a.slice();return a.length=0,y}corner(){const i=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const o=this.children[r];o.translation.x-=i.left,o.translation.y-=i.top}return this.mask&&(this.mask.translation.x-=i.left,this.mask.translation.y-=i.top),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.children.length;s++){const a=this.children[s];a.isShape&&(a.translation.x-=r,a.translation.y-=o)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getById(i){let r=null;function o(s){if(s.id===i)return s;if(s.children){if(s.children.ids[i])return s.children.ids[i];for(let a=0;a<s.children.length;a++)if(r=o(s.children[a]),r)return r}return null}return o(this)}getByClassName(i){const r=[];function o(s){if(Array.prototype.indexOf.call(s.classList,i)>=0&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}getByType(i){const r=[];function o(s){if(s instanceof i&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}add(i){i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let r=0;r<i.length;r++){const o=i[r];if(!(o&&o.id))continue;const s=Array.prototype.indexOf.call(this.children,o);s>=0&&this.children.splice(s,1),this.children.push(o)}return this}remove(i){const r=arguments.length,o=this.parent;if(r<=0&&o)return o.remove(this),this;i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let s=0;s<i.length;s++){const a=i[s];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(i){let r,o,s,a,l,c;this._update(!0);let d=1/0,u=-1/0,f=1/0,h=-1/0;const p=/texture|gradient/i;o=i?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const g=this.children[m];if(!(!g.visible||p.test(g._renderer.type))&&(r=g.getBoundingClientRect(i),s=typeof r.top!="number"||We.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||We.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||We.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||We.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(i){const[b,y]=o.multiply(r.left,r.top),[_,k]=o.multiply(r.right,r.top),[x,v]=o.multiply(r.left,r.bottom),[B,w]=o.multiply(r.right,r.bottom);f=qo(y,k,v,w,f),d=qo(b,_,x,B,d),u=Xo(b,_,x,B,u),h=Xo(y,k,v,w,h)}else f=qo(r.top,f),d=qo(r.left,d),u=Xo(r.right,u),h=Xo(r.bottom,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}noFill(){return this.children.forEach(function(i){i.noFill()}),this}noStroke(){return this.children.forEach(function(i){i.noStroke()}),this}subdivide(){const i=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,i)}),this}_update(){let i,r,o;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=s*l,u=a*l;for(i=0;i<this.children.length;i++)o=this.children[i],r=o.length,d>c+r?(o.beginning=1,o.ending=1):u<c?(o.beginning=0,o.ending=0):d>c&&d<c+r?(o.beginning=(d-c)/r,o.ending=1):u>c&&u<c+r?(o.beginning=0,o.ending=(u-c)/r):(o.beginning=0,o.ending=1),c+=r}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};N(zt,"Children",du),N(zt,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let qn=zt;const vu={visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._flagVisible=this._visible!==n||this._flagVisible,this._visible=n}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._flagOpacity=this._opacity!==n||this._flagOpacity,this._opacity=n}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._flagBeginning=this._beginning!==n||this._flagBeginning,this._beginning=n}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._flagEnding=this._ending!==n||this._flagEnding,this._ending=n}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let n=0;n<this.children.length;n++){const e=this.children[n];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){this._fill=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=n}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){this._stroke=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=n}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=n}}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=n}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=n}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=n}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=n}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=n}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){this._automatic=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=n}}},children:{enumerable:!0,get:function(){return this._children},set:function(n){const e=qn.InsertChildren.bind(this),i=qn.RemoveChildren.bind(this),r=qn.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new du(n),this._children.bind(te.Types.insert,e),this._children.bind(te.Types.remove,i),this._children.bind(te.Types.order,r),n.length>0&&e(n)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=n)}}}};function Su(n,e){const i=n.parent;let r;if(i===e){o();return}if(i&&i.children.ids[n.id]&&(r=Array.prototype.indexOf.call(i.children,n),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete n.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,n),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,n),r>=0&&e.additions.splice(r,1)),n.parent=e,e.additions.push(n),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,n),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,n),r<0&&(i.subtractions.push(n),i._flagSubtractions=!0)}}class Yo extends Ae{constructor(e,i,r,o){const s=[new Ie(e,i),new Ie(r,o)];super(s);for(let a in Bu)Object.defineProperty(this,a,Bu[a]);this.vertices[0].command=fe.move,this.vertices[1].command=fe.line,this.automatic=!1}}N(Yo,"Properties",["left","right"]);const Bu={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(We.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=fe.move;else{const e=new Io("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(n){if(We.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=fe.line;else{const e=new Io("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Ta{constructor(e=0,i=0){this.x=e,this.y=i}}class Rn{constructor(e=10,i=0,r="A"){N(this,"start",new Ta);N(this,"end",new Ta);this.width=e,this.angle=i,this.label=r}}const Ye={line:{color:"#000",size:5},previewLine:{color:"#000",size:2},anchorPoint:{color:"#FF8000",size:12,strokeSize:20},lineLabel:{color:"#FF8000",size:22,rotation:-.5},angleLabel:{size:22,color:"#088c00",rotation:-.5},colorSideLabel:{size:20,color:"#439227"}},D1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function L1(n,e){return t.openBlock(),t.createElementBlock("svg",D1,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m289.94 256l95-95A24 24 0 0 0 351 127l-95 95l-95-95a24 24 0 0 0-34 34l95 95l-95 95a24 24 0 1 0 34 34l95-95l95 95a24 24 0 0 0 34-34Z"},null,-1)])])}const Uo=t.markRaw({name:"ion-close",render:L1}),H1={class:"mr-3 flex flex-col gap-2"},W1=["onClick"],j1={class:"h-full p-2"},q1={},X1=t.defineComponent({...q1,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(n,{emit:e}){const i=n,r=t.ref(!1),o=t.useTemplateRef("drawing-template-containers"),s=t.useTemplateRef("drawing-custom-template-containers"),a=e,l=c=>{r.value=!0,a("remove-custom-template",c,()=>{r.value=!1})};return t.onMounted(()=>{var c,d;(c=i.settings.templates)==null||c.forEach((u,f)=>{var p;const h=(p=o.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)}),(d=i.settings.customTemplates)==null||d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)})}),t.watch(()=>[...i.settings.customTemplates],(c,d)=>{t.nextTick(()=>{c.forEach((u,f)=>{var h;if(!(d!=null&&d.includes(u))){const p=(h=s.value)==null?void 0:h.at(f);p&&a("init-draw-template",p,u)}}),d.length>c.length&&d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&(h.innerHTML="",a("init-draw-template",h,u))})})},{deep:!0}),(c,d)=>{const u=Uo;return t.openBlock(),t.createBlock(t.unref(F.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:t.withCtx(()=>[t.createElementVNode("div",H1,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.settings.allTemplates,(f,h)=>(t.openBlock(),t.createElementBlock("div",{key:`${f.id}-${h}`,class:"group relative"},[t.createVNode(t.unref(F.NPopover),{trigger:"hover",placement:"right"},{trigger:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":h===n.selectTemplateIndex}]),onClick:p=>a("template:select",h)},[t.createElementVNode("div",j1,[t.createElementVNode("div",{ref_for:!0,ref:f.isCustom&&f.id!==-1?"drawing-custom-template-containers":"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,W1)]),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.label),1)]),_:2},1024),f.isCustom&&!f.isNewRec()?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,size:"tiny",quaternary:"",loading:r.value,disabled:r.value,circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:p=>l(h)},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):t.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Nu=fn(X1,[["__scopeId","data-v-afccb364"]]),Y1={class:"flex gap-3 min-w-[20rem] relative"},U1={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},K1={ref:"drawing-container",class:"size-full"},G1={},Tu=t.defineComponent({...G1,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select","remove-custom-template"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("drawing-container");let s=[],a=[],l=[],c=null;const d=.75,u=t.computed(()=>i.value.configuratorParams.linesAngles.map((W,D)=>new Rn(i.value.configuratorParams.linesWidths[D],W,`A-${D+1}`))),f=t.computed(()=>i.value.configuratorParams.colorSide==="bottom"),h=t.computed(()=>{var W,D;return i.value.configuratorParams.startTailType&&((W=i.settings.startTailConfigs)!=null&&W[i.value.configuratorParams.startTailType])?(D=i.settings.startTailConfigs)==null?void 0:D[i.value.configuratorParams.startTailType].points:[]}),p=t.computed(()=>{var D;const W=i.value.configuratorParams.endTailType!==void 0&&((D=i.settings.endTailConfigs)==null?void 0:D[i.value.configuratorParams.endTailType]);return!W||!W.points?[]:W.points.map((L,z)=>Array.isArray(L)?new Rn(L[0],L[1],`A-${z+1}`):new Rn(L.width,L.angle,`A-${z+1}`))}),m=(W,D=!1)=>{W[0].start.x=0,W[0].start.y=0;let L=0;for(let z=0;z<W.length;z++){const P=W[z],q=W[z-1]??new Rn(0,L);L+=!D||z>1?q.angle:0;const K=(!D||z>0?P.angle:0)+L;if(W[z].end.x=P.width*Math.cos(K*Math.PI/180)+W[z].start.x,W[z].end.y=P.width*Math.sin(K*Math.PI/180)+W[z].start.y,z<W.length-1){const J=z+1;W[J].start.x=W[z].end.x,W[J].start.y=W[z].end.y}}return W},g=(W,D,L,z,P=!1)=>{let q=m([...L,...z]);D.length>0&&(q=[...m(D),...q]);let K=0,J=0,Y=0,V=0;q.forEach(pe=>{K=Math.min(K,pe.start.x,pe.end.x),J=Math.min(J,pe.start.y,pe.end.y),Y=Math.max(Y,pe.start.x,pe.end.x),V=Math.max(V,pe.start.y,pe.end.y)});let A,ie;K===0&&J===0&&Y===0&&V===0?(A=1,ie=1):(A=W.width/Math.abs(Y-K),ie=(P?W.height:W.height-Ye.colorSideLabel.size)/Math.abs(V-J));const ce=Math.min(A,ie);return K=K<0?-K*ce:0,J=J<0?-J*ce:0,[ce,K,J]},b=W=>{const D=new jo([W]);return D._size=Ye.anchorPoint.size,D.fill=Ye.anchorPoint.color,D.stroke="transparent",D._linewidth=Ye.anchorPoint.strokeSize,l.push(D),D},y=(W,D)=>{if(l=[],i.settings.allowChangeFirstPoint){const L=W[0],z=new ge(L.vertices[0].x,L.vertices[0].y);z.bind(te.Types.change,()=>{L.vertices[0].copy(z)});const P=b(z);D.add(P)}W.forEach((L,z)=>{const P=W[z+1],q=new ge(L.vertices[1].x,L.vertices[1].y);q.bind(te.Types.change,()=>{L.vertices[1].copy(q),P!==void 0&&P.vertices[0].copy(q)});const K=b(q);D.add(K)})},_=W=>W*(Math.PI/180),k=(W,D,L)=>{const z=D.vertices.length-1;W.position.x=D.vertices[z].x,W.position.y=D.vertices[z].y;const P=Math.atan2(D.vertices[z].y-D.vertices[0].y,D.vertices[z].x-D.vertices[0].x);W.rotation=_(L)+P},x=(W,D,L)=>{if(D.vertices[0]===void 0)return;W.position.x=D.vertices[0].x,W.position.y=D.vertices[0].y;const z=D.vertices.length-1,P=Math.atan2(D.vertices[z].y-D.vertices[0].y,D.vertices[z].x-D.vertices[0].x);W.rotation=_(L)+P},v=(W,D,L)=>{const z=new qn;if(W.length===0)return z;const P=[];return[...W].reverse().forEach((q,K)=>{K!==0&&q.angle>0&&(q.angle*=-1),P.push(q)}),W=m(P,!0),x(z,D,W[0].angle),[D.vertices[0],D.vertices[1]].forEach(q=>{q.bind(te.Types.change,()=>{x(z,D,W[0].angle)})}),W.forEach(q=>{const K=q.start.x*L,J=q.end.x*L,Y=q.start.y*L,V=q.end.y*L,A=new Yo(K,Y,J,V);A.linewidth=Ye.line.size,A.stroke=Ye.line.color,z.add(A)}),z},B=(W,D,L)=>{const z=new qn;return W.length===0||(W=m(W,!0),k(z,D,W[0].angle),[D.vertices[0],D.vertices[1]].forEach(P=>{P.bind(te.Types.change,()=>{k(z,D,W[0].angle)})}),W.forEach(P=>{const q=P.start.x*L,K=P.end.x*L,J=P.start.y*L,Y=P.end.y*L,V=new Yo(q,J,K,Y);V.linewidth=Ye.line.size,V.stroke=Ye.line.color,z.add(V)})),z},w=(W,D,L,z)=>{const P=D.vertices[0].x+(D.vertices[1].x-D.vertices[0].x)/2-8*Math.sin(W.angle*Math.PI/180),q=D.vertices[0].y+(D.vertices[1].y-D.vertices[0].y)/2-8*Math.cos(W.angle*Math.PI/180),K=new dr(W.label,P+10,q-10);let J;K.size=Ye.lineLabel.size,K.weight=600,K.fill=Ye.lineLabel.color,K.id+=1,K.rotation=Ye.lineLabel.rotation,z>0&&(J=new dr(`${W.angle}°`,D.vertices[0].x+25,D.vertices[0].y-25),J.size=Ye.angleLabel.size,J.weight=600,J.fill=Ye.angleLabel.color,J.rotation=Ye.angleLabel.rotation,J.id+=z,s.push(J),L.add(J)),L.add(K),C(K,D,0,J),C(K,D,1)},T=()=>{const{size:W}=Ye.colorSideLabel,D=0,L=0,z=f.value?W/2:W/2-W,P=f.value?W/2-W:W/2,q=new qn;if(!c)return q;const K=5,J=Math.atan2(P-z,L-D),Y=[new Ie(D,z,0,0,0,0,Nn.Commands.move),new Ie(L,P,0,0,0,0,Nn.Commands.line),new Ie(L-K*Math.cos(J-Math.PI/4),P-K*Math.sin(J-Math.PI/4),0,0,0,0,Nn.Commands.line),new Ie(L,P,0,0,0,0,Nn.Commands.move),new Ie(L-K*Math.cos(J+Math.PI/4),P-K*Math.sin(J+Math.PI/4),0,0,0,0,Nn.Commands.line)],V=new Ae(Y,!1,!1,!0);V.noFill(),V.cap="round",V.join="round",V.linewidth=W/7,V.stroke=Ye.colorSideLabel.color,q.add(V);const A=new dr(f.value?"Цвет снизу":"Цвет сверху",10,0);A.size=W,A.weight=600,A.fill=Ye.colorSideLabel.color,A.alignment="left",q.add(A);const ie=q.getBoundingClientRect();return q.position.x=(c.width-ie.width)*d+10,q.position.y=f.value?c.height+ie.height*2:ie.height/2,q},C=(W,D,L,z)=>{D.vertices[L].bind(te.Types.change,()=>{const P=D.vertices.length-1,q=Math.atan2(D.vertices[0].y-D.vertices[P].y,D.vertices[0].x-D.vertices[P].x)*180/Math.PI,K=D.vertices[0].x+(D.vertices[P].x-D.vertices[0].x)/2-8*Math.sin(q*Math.PI/180),J=D.vertices[0].y+(D.vertices[P].y-D.vertices[0].y)/2-8*Math.cos(q*Math.PI/180);W.position.x=K+10,W.position.y=J-10,W.rotation=-.5,z&&(z.position.x=D.vertices[0].x+25,z.position.y=D.vertices[0].y-25)})},$=(W,D,L,z,P=!1)=>{var at;if(W.clear(),L.length===0){W.update();return}const q=m(L),[K,J,Y]=g(W,D,q,z,P),V=new qn,A=new Array,ie=new Array;P||(s=[],a=[]),q.forEach((we,ke)=>{const kt=we.start.x*K+J,Ne=we.end.x*K+J,Jt=we.start.y*K+Y,wn=we.end.y*K+Y,Pt=new Yo(kt,Jt,Ne,wn);Pt.linewidth=P?Ye.previewLine.size:Ye.line.size,Pt.stroke=P?Ye.previewLine.color:Ye.line.color,a.push(Pt),A.push(Pt),V.add(Pt),!P&&we.label!==""&&w(we,Pt,V,ke)});const ce=A.at(-1);let pe=V.getBoundingClientRect();if(!P){const we=T();ie.push(we)}if(D.length>0){const we=v(D,A[0],K);V.add(we)}if(z.length>0&&ce){const we=B(z,ce,K);V.add(we)}if(ie.push(V),W.makeGroup(ie),pe=V.getBoundingClientRect(),V.position.x=0-pe.left+(W.width-pe.width)/(2*(P?1:d)),V.position.y=0-pe.top+(W.height-pe.height)/(2*(P?1:d)),W.update(),!P){const we=((at=i.value.configuratorParams)==null?void 0:at.colorSide)==="top";V.position.y=V.position.y+Ye.colorSideLabel.size*Number(we),y(A,V),W.update()}},E=(W,D)=>{if(W&&!D.isNewRec()){const L=new Nn({width:W.scrollWidth,height:W.scrollHeight});L.appendTo(W),$(L,[],D.points,[],!0)}},I=()=>{c&&$(c,h.value,u.value,p.value,!1)},R=W=>W*(180/Math.PI),O=(W,D)=>{const L=W[1].x-W[0].x,z=W[1].y-W[0].y,P=D[1].x-D[0].x,q=D[1].y-D[0].y;let K=Math.atan2(L*q-z*P,L*P+z*q);return K=R(K),Math.round(K)*-1},U=W=>{const D=a.map((L,z,P)=>{const q=P[z-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Math.ceil(L._length/W/i.settings.lineWidthStep)*i.settings.lineWidthStep;const J=s[z-1];K<(P.length>1?i.settings.minLineWidth:i.settings.stripMinWidth)&&(K=P.length>1?i.settings.minLineWidth:i.settings.stripMinWidth),K>i.settings.maxLineWidth&&(K=i.settings.maxLineWidth);const Y=O(L.vertices,q.vertices);return J&&(J.value=`${Y}°`),new Rn(K,Y,`A-${z+1}`)});r("pointer:move",D)},Q=W=>{let D=null,L;const z=J=>{D=l.find(Y=>{const V=Y.renderer;return(V==null?void 0:V.elem)===J.target}),[L]=g(W,h.value,u.value.map(Y=>Y),p.value)},P=J=>{if(D){const Y=D.renderer,V=Y==null?void 0:Y.elem;if(!V)return;const A=V.getBoundingClientRect();D.vertices[0].x-=A.x-(J instanceof MouseEvent?J.clientX:J.targetTouches[0].clientX)+Ye.anchorPoint.size/2,D.vertices[0].y-=A.y-(J instanceof MouseEvent?J.clientY:J.targetTouches[0].clientY)+Ye.anchorPoint.size/2,U(L),W.update()}},q=()=>{D&&r("pointer:up",u.value),D=null},K=o.value;K&&(K.addEventListener("touchstart",z,{passive:!0}),K.addEventListener("touchend",q,{passive:!0}),K.addEventListener("mousedown",z),K.addEventListener("mouseup",q),K.addEventListener("mousemove",P),K.addEventListener("touchmove",P,{passive:!0}))},G=(W,D)=>{r("remove-custom-template",W,D)};return t.onMounted(()=>{o.value&&(c=new Nn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),t.watch(()=>i.value,()=>{I()},{deep:!0,immediate:!0}),Q(c))}),t.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(W,D)=>(t.openBlock(),t.createElementBlock("div",Y1,[t.createVNode(Nu,{"select-template-index":n.selectTemplateIndex,settings:n.settings,"onTemplate:select":D[0]||(D[0]=L=>r("template:select",L)),onInitDrawTemplate:E,onRemoveCustomTemplate:G},null,8,["select-template-index","settings"]),t.createElementVNode("div",U1,[t.createElementVNode("div",K1,null,512)])]))}});class ur extends j.Identity{constructor(i,r){super();N(this,"label","");N(this,"points",[]);N(this,"isCustom",!1);N(this,"id",-1);N(this,"guid","");i?(this.label=i.label,this.points=i.points.map((o,s)=>M.isArray(o)?new Rn(o[0],o[1],`A-${s+1}`):new Rn(o.width,o.angle,`A-${s+1}`)),this.isCustom=i.isCustom):(this.label="-- Новая конфигурация --",this.points=[new Rn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class $a extends ur{constructor(i){super(i);N(this,"isDefault");this.isDefault=i.isDefault??!1}}class $u{constructor(e){N(this,"minLineWidth");N(this,"maxLineWidth");N(this,"lineWidthStep");N(this,"minLineAngle");N(this,"maxLineAngle");N(this,"lineAngleStep");N(this,"stripMinWidth");N(this,"stripMaxWidth");N(this,"stripMinLength");N(this,"stripMaxLength");N(this,"allowShowTable");N(this,"showOnlyTemplates");N(this,"templates");N(this,"customTemplates",[]);N(this,"startTailConfigs");N(this,"endTailConfigs");N(this,"bendCountForExtended");N(this,"extendedProductCatalog");N(this,"allowChangeFirstPoint");N(this,"allowSaveTemplates");N(this,"userTemplatesPrefix");N(this,"lengthStep");N(this,"canSetDopProdaga");var i,r;this.minLineWidth=e.minLineWidth,this.maxLineWidth=e.maxLineWidth,this.lineWidthStep=e.lineWidthStep,this.minLineAngle=e.minLineAngle,this.maxLineAngle=e.maxLineAngle,this.lineAngleStep=e.lineAngleStep,this.stripMinWidth=e.stripMinWidth,this.stripMaxWidth=e.stripMaxWidth,this.stripMinLength=e.stripMinLength,this.stripMaxLength=e.stripMaxLength,this.allowShowTable=e.allowShowTable,this.showOnlyTemplates=e.showOnlyTemplates,this.templates=e.templates.map(o=>new ur(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((i=e.startTailConfigs)==null?void 0:i.map(o=>new $a(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new $a(o)))??[],this.bendCountForExtended=e.bendCountForExtended,this.extendedProductCatalog=e.extendedProductCatalog,this.allowChangeFirstPoint=e.allowChangeFirstPoint,this.allowSaveTemplates=e.allowSaveTemplates,this.userTemplatesPrefix=e.userTemplatesPrefix,this.lengthStep=e.lengthStep,this.canSetDopProdaga=e.canSetDopProdaga,this.showOnlyTemplates||(this.customTemplates=e.customTemplates?Object.entries(e.customTemplates).filter(([,o])=>o.id!==-1).map(([o,s])=>{const a=new ur(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new ur({label:"-- Новая конфигурация --",points:[new Rn(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findLast(o=>!o.isNewRec()),r=new ur(e);r.isCustom=!0,r.id=i?i.id+1:0,this.customTemplates.splice(-1,0,r)}removeCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findIndex(r=>r.id===e);i!==-1&&this.customTemplates.splice(i,1)}}const Z1={class:"flex flex-col gap-3"},Q1={class:"grid gap-5 md:grid-cols-5"},J1={},Eu=t.defineComponent({...J1,__name:"kozyrek-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.ref(new $u(i.settings)),d=t.ref({linesWidths:[...i.cartItem.configuratorParams.linesWidths],linesAngles:[...i.cartItem.configuratorParams.linesAngles]}),u=t.ref({quantity:{},marker:{},length:{}}),f=t.ref(0),h=t.useTemplateRef("kozyrek-configurator-params-form"),p=(C=0)=>{var E;const $=(E=c.value.allTemplates)==null?void 0:E.at(C);$!==void 0&&(f.value=C,l.value.configuratorParams.linesWidths=$.points.map(I=>M.isArray(I)?I[0]:I.width),l.value.configuratorParams.linesAngles=$.points.map(I=>M.isArray(I)?I[1]:I.angle),k()),y(l.value.configuratorParams)},m=async()=>{const C=prompt("Введите название шаблона:");if(!C)return;a.value=!0;const $={label:C,points:l.value.configuratorParams.linesWidths.map((I,R)=>[I,l.value.configuratorParams.linesAngles[R]])},E=I=>{I&&(c.value.addCustomTemplate($),f.value=c.value.allTemplates.length-2),a.value=!1};i.eventEmitter.emit("configurator:create-template",{category:i.cartItem.category,template:$,callback:E})},g=async(C,$)=>{var R;const E=(R=c.value.allTemplates)==null?void 0:R.at(C);if(!E||!E.isCustom)return;const I=O=>{O&&(c.value.removeCustomTemplate(E.id),p()),$==null||$()};i.eventEmitter.emit("configurator:remove-template",{category:i.cartItem.category,templateId:E.id,callback:I})},b=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(f.value=c.value.allTemplates.length-1)},y=async C=>{var $,E;l.value.product=new j.ClientProduct,(E=($=h.value)==null?void 0:$.formReference)==null||E.validate(I=>{I||(k(),o.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:C,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(M.noop)},_=async()=>{var C,$;($=(C=h.value)==null?void 0:C.formReference)==null||$.validate(E=>{var I,R;if(!E){s.value=!0;const O=new j.OrderItemBase(l.value);(I=c.value.startTailConfigs)!=null&&I.length||delete O.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete O.configuratorParams.endTailType,r("submit",O,u.value,()=>{s.value=!1,t.nextTick(()=>{var U,Q;(Q=(U=h.value)==null?void 0:U.formReference)==null||Q.restoreValidation()})})}}).catch(M.noop)},k=()=>{const C={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach(($,E)=>{C[`lines_widths[${E+1}]`]={},C[`lines_angles[${E+1}]`]={}}),u.value=C},x=C=>{d.value.linesWidths=C.map($=>$.width),d.value.linesAngles=C.map($=>$.angle)},v=C=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,k(),b(),y(l.value.configuratorParams)},B=(C,$)=>{d.value.linesWidths=C,d.value.linesAngles=$},w=C=>{const $=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,E=0;l.value.configuratorParams.linesWidths.splice(C+1,0,$),l.value.configuratorParams.linesAngles.splice(C+1,0,E),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),b(),y(l.value.configuratorParams)},T=C=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(C,1),l.value.configuratorParams.linesAngles.splice(C,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),b(),y(l.value.configuratorParams))};return t.onMounted(()=>{i.cartItem.isNewRec()?p():(k(),f.value=-1,y(l.value.configuratorParams))}),t.watch(()=>i.cartItem,C=>{l.value=new j.OrderItemBase(C),C.isNewRec()?p():(k(),f.value=-1,y(l.value.configuratorParams))}),(C,$)=>{const E=F.NButton;return t.openBlock(),t.createElementBlock("div",Z1,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(E,{key:0,type:"tertiary",class:"self-end",onClick:$[0]||($[0]=I=>r("click:view-switch"))},{default:t.withCtx(()=>[...$[3]||($[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",Q1,[t.createVNode(Tu,{value:l.value,"select-template-index":f.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":v,"onPointer:move":x,"onTemplate:select":p,onRemoveCustomTemplate:g},null,8,["value","select-template-index","settings"]),t.createVNode(lc,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":$[1]||($[1]=I=>l.value=I),"preview-params":d.value,validation:u.value,settings:c.value,"is-submit-processing":s.value,"is-product-searching":o.value,"select-template-index":f.value,class:"col-span-2","onUpdate:params":$[2]||($[2]=I=>y(I)),"onUpdate:preview":B,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":w,"onClick:removeLine":T},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),eb={class:"flex flex-col items-center justify-between rounded-xl"},tb={class:"img-preview relative flex justify-center"},nb={},ib=t.defineComponent({...nb,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(n,{emit:e}){const i=n,r=t.computed(()=>{const{height:s}=i.configuratorParams;return M.keys(i.settings.crossbarCount).reverse().find(a=>s>=i.settings.crossbarCount[Number(a)])}),o=e;return(s,a)=>{const l=F.NButton;return t.openBlock(),t.createElementBlock("div",eb,[t.createElementVNode("div",tb,[a[1]||(a[1]=t.createElementVNode("div",{class:"window"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["net",`net-${n.configuratorParams.netType}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["frame",`frame-${n.configuratorParams.color}`])},null,2),r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${n.configuratorParams.color}`])},null,2)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["mount",`mount-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["cut-preview",`cut-preview-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2)]),t.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>o("open-instructions"))},{default:t.withCtx(()=>[...a[2]||(a[2]=[t.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),Ea=fn(ib,[["__scopeId","data-v-2a790a20"]]),rb={key:0,class:"flex items-baseline gap-1"},ob={key:0,class:"flex items-baseline gap-1"},sb={key:1},ab={class:"text-lg font-semibold"},lb={key:2,class:"text-red-500 text-sm mb-2"},cb={class:"flex gap-3"},db={},Ru=t.defineComponent({...db,__name:"mosquito-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:instructions-toggle","click:show-preview-drawer"],setup(n,{expose:e,emit:i}){var w;const r=n,o=i,s=t.computed(()=>Xe.isPhoneDevice()),a=t.useTemplateRef("form-reference"),l=t.useTemplateRef("width-form-item-reference"),c=t.useTemplateRef("height-form-item-reference"),d=t.useTemplateRef("width-input-reference"),u=t.ref(M.cloneDeep(r.value)),f=t.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),h=t.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),p=t.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),m=t.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),g=t.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+f.value:0),b=t.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+h.value:0),y=t.ref(r.settings.canSetDopProdaga??!1),_=t.computed(()=>({"configuratorParams.width":[le.required,le.min(r.settings.minWidth-f.value),le.max(p.value-f.value),le.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[le.required,le.min(r.settings.minHeight-h.value),le.max(m.value-h.value),le.step(1),He.serverValidation(r.validation.height.feedback)],quantity:[le.required,le.min(1),le.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),k=t.computed(()=>{var R;const T=g.value,C=b.value,{quantity:$}=r.value,E=((R=r.value.product)==null?void 0:R.costRub)||0;if(!T||!C||!$||E===0)return null;const I=T*C/1e6;return(E*$*I).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=t.computed(()=>{const T=g.value,C=b.value,$=!!(T&&T>=r.settings.minWidth&&T<=r.settings.maxWidths[u.value.configuratorParams.netType]),E=!!(C&&C>=r.settings.minHeight&&C<=r.settings.maxHeights[u.value.configuratorParams.netType]),I=!!(r.value.quantity&&r.value.quantity>0);return $&&E&&I}),v=(T,C)=>{var I,R;const $=u.value.configuratorParams;T&&T in $&&($[T]=C);const E={...$,width:g.value??0,height:b.value??0};T==="width"&&((I=l.value)==null||I.validate().catch(M.noop)),T==="height"&&((R=c.value)==null||R.validate().catch(M.noop)),t.nextTick(()=>{var U,Q;!((U=l.value)!=null&&U.validationErrored)&&!((Q=c.value)!=null&&Q.validationErrored)&&E.height&&E.width&&o("update:params",E),B("configuratorParams",E)})},B=(T,C)=>{const $=new j.OrderItemBase(r.value);$[T]=C,T==="configuratorParams"&&($.product=new j.ClientProduct),o("update:value",$)};return t.watch(()=>r.value,T=>{const C=M.cloneDeep(t.toRaw(T)),$=C.configuratorParams.mountType,E=r.settings.widthOverlaps[$]??0,I=r.settings.heightOverlaps[$]??0;C.configuratorParams.width&&C.configuratorParams.width>0&&(C.configuratorParams.width-=E),C.configuratorParams.height&&C.configuratorParams.height>0&&(C.configuratorParams.height-=I),u.value=C},{deep:!0,immediate:!0}),t.onMounted(()=>{var T;(T=d.value)==null||T.select()}),e({validate:(w=a.value)==null?void 0:w.validate,formReference:a}),(T,C)=>{const $=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:u.value,rules:_.value,class:"flex flex-col gap-2 px-4 md:max-w-96 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[C[0]||(C[0]=E=>u.value.configuratorParams.netType=E),C[1]||(C[1]=E=>v("netType",E))],options:n.settings.netType.map(E=>({label:n.settings.descriptions.net_type[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[C[2]||(C[2]=E=>u.value.configuratorParams.color=E),C[3]||(C[3]=E=>v("color",E))],options:n.settings.color.map(E=>({label:n.settings.descriptions.color[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[C[4]||(C[4]=E=>u.value.configuratorParams.mountType=E),C[5]||(C[5]=E=>v("mountType",E))],options:n.settings.mountType.map(E=>({label:n.settings.descriptions.mount_type[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{ref:"width-form-item-reference",path:"configuratorParams.width",label:`Ширина светового проёма от ${n.settings.minWidth-f.value} ${p.value?" до "+(p.value-f.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.width.showFeedback&&g.value>=n.settings.minWidth&&g.value<=n.settings.maxWidths[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",rb,[t.createVNode(t.unref(F.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Ширина готового изделия "+t.toDisplayString(g.value),1)]),_:1}),t.createVNode(t.unref(F.NButton),{quaternary:"",type:"info",size:"tiny",onClick:C[10]||(C[10]=E=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...C[25]||(C[25]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[C[6]||(C[6]=E=>u.value.configuratorParams.width=E),C[9]||(C[9]=E=>v("width",E))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:C[7]||(C[7]=E=>t.unref(lt)(E)),onInput:C[8]||(C[8]=E=>t.unref(ot)(n.validation,"width")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${n.settings.minHeight-h.value} ${m.value?" до "+(m.value-h.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.height.showFeedback&&b.value>=n.settings.minHeight&&b.value<=n.settings.maxHeights[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",ob,[t.createVNode(t.unref(F.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Высота готового изделия "+t.toDisplayString(b.value),1)]),_:1}),t.createVNode(t.unref(F.NButton),{quaternary:"",type:"info",size:"tiny",onClick:C[15]||(C[15]=E=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...C[26]||(C[26]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[C[11]||(C[11]=E=>u.value.configuratorParams.height=E),C[14]||(C[14]=E=>v("height",E))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:C[12]||(C[12]=E=>t.unref(lt)(E)),onInput:C[13]||(C[13]=E=>t.unref(ot)(n.validation,"height")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:u.value.quantity,"onUpdate:value":[C[16]||(C[16]=E=>u.value.quantity=E),C[19]||(C[19]=E=>B("quantity",E??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:C[17]||(C[17]=E=>t.unref(lt)(E,!1)),onInput:C[18]||(C[18]=E=>t.unref(ot)(n.validation,"quantity")),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:C[20]||(C[20]=E=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":C[21]||(C[21]=E=>{u.value.marker=E??null,B("marker",E??null)}),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),y.value?(t.openBlock(),t.createBlock($,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":C[22]||(C[22]=E=>{u.value.isAdditionalSale=E??!1,B("isAdditionalSale",E??!1)})},{default:t.withCtx(()=>[...C[27]||(C[27]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode($r,{"is-product-searching":n.isProductSearching,product:u.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),k.value?(t.openBlock(),t.createElementBlock("div",sb,[C[28]||(C[28]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",ab,t.toDisplayString(k.value)+" ₽",1)])):t.createCommentVNode("",!0),x.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",lb," Пожалуйста, заполните все обязательные поля корректно. ")),t.createElementVNode("div",cb,[t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:C[23]||(C[23]=E=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,type:"default",onClick:C[24]||(C[24]=E=>o("click:show-preview-drawer"))},{default:t.withCtx(()=>[...C[29]||(C[29]=[t.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):t.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",u.value)]])}}}),ub="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",fb="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",hb="/img/configurators/mosquitto/measurement-instructions/mount.png",mb="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",pb="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",gb={class:"flex flex-col gap-6"},yb={class:"flex gap-4"},bb={class:"flex flex-col gap-2"},_b={class:"flex gap-4"},wb={class:"flex flex-col gap-2"},xb={class:"flex gap-4"},kb={class:"flex flex-col gap-2"},Cb={},Pu=t.defineComponent({...Cb,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(n,{emit:e}){const i=Xe.initRefDependingOnDeviceResolution("small","small","medium"),r=Xe.initRefDependingOnDeviceResolution(.98,.95,.8),o=t.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=F.NText;return t.openBlock(),t.createBlock(t.unref(F.NModal),{show:n.show,"show-icon":!1,size:t.unref(i),style:t.normalizeStyle(`width: ${o.value}px`),title:"Руководство по замеру","action-class":"grid grid-cols-2 !justify-between",preset:"dialog",onClose:l[0]||(l[0]=d=>s("update:show",!1)),onEsc:l[1]||(l[1]=d=>s("update:show",!1)),onMaskClick:l[2]||(l[2]=d=>s("update:show",!1))},{default:t.withCtx(()=>[t.createElementVNode("div",gb,[t.createVNode(c,{type:"error",class:"text-base font-medium"},{default:t.withCtx(()=>[...l[3]||(l[3]=[t.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=t.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:ub,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),t.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:fb,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),t.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),t.createElementVNode("div",yb,[l[9]||(l[9]=t.createElementVNode("img",{src:hb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",bb,[l[8]||(l[8]=t.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),t.createElementVNode("span",null,[l[4]||(l[4]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.frame)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=t.createElementVNode("br",null,null,-1)),l[7]||(l[7]=t.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),t.createElementVNode("div",_b,[l[15]||(l[15]=t.createElementVNode("img",{src:mb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",wb,[l[14]||(l[14]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),t.createElementVNode("span",null,[l[10]||(l[10]=t.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=t.createElementVNode("br",null,null,-1)),l[13]||(l[13]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),t.createElementVNode("div",xb,[l[21]||(l[21]=t.createElementVNode("img",{src:pb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",kb,[l[20]||(l[20]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),t.createElementVNode("span",null,[l[16]||(l[16]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_metal)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=t.createElementVNode("br",null,null,-1)),l[19]||(l[19]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),vb={class:"grid md:grid-cols-2"},Sb={},Fu=t.defineComponent({...Sb,__name:"mosquito-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>Xe.isPhoneDevice()),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.useTemplateRef("mosquito-configurator-form"),d=t.ref({width:{},height:{},quantity:{},marker:{}}),u=t.ref(!1),f=t.ref(!1),h=t.computed(()=>t.inject("debounce-input-time",300)),p=M.debounce(async g=>{var b,y;l.value.product=new j.ClientProduct,(y=(b=c.value)==null?void 0:b.formReference)==null||y.validate(_=>{_||(u.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:g,validationFieldResultData:d.value,callback:k=>{k?l.value.product=k:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(M.noop)},h.value),m=()=>{f.value=!0,r("submit",l.value,d.value,()=>{f.value=!1})};return t.watch(()=>i.cartItem,g=>{l.value=g},{deep:!0}),(g,b)=>{const y=Uo;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(Pu,{show:a.value,"onUpdate:show":b[0]||(b[0]=_=>a.value=_),"height-overlaps":n.settings.heightOverlaps,"width-overlaps":n.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),t.createElementVNode("div",vb,[o.value?(t.openBlock(),t.createBlock(t.unref(F.NDrawer),{key:1,show:s.value,"onUpdate:show":b[4]||(b[4]=_=>s.value=_),"default-width":375,resizable:""},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NDrawerContent),null,{header:t.withCtx(()=>[t.createVNode(t.unref(F.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:b[2]||(b[2]=_=>s.value=!1)},{default:t.withCtx(()=>[t.createVNode(y)]),_:1})]),default:t.withCtx(()=>[t.createVNode(Ea,{"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[3]||(b[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(t.openBlock(),t.createBlock(Ea,{key:0,"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[1]||(b[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),t.createVNode(Ru,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":b[5]||(b[5]=_=>l.value=_),validation:d.value,settings:n.settings,"is-product-searching":u.value,"is-submit-processing":f.value,"onUpdate:params":b[6]||(b[6]=_=>t.unref(p)(_)),onSubmit:b[7]||(b[7]=_=>m()),"onClick:instructionsToggle":b[8]||(b[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":b[9]||(b[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),Bb={},Vu=t.defineComponent({...Bb,__name:"strip-configurator-line-item",props:{value:{},index:{},path:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},isLastLine:{type:Boolean,default:!1},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useTemplateRef("width-input-element"),a=t.ref(!1),l=t.ref(r.value),c=t.useTemplateRef("form-item-reference"),d=t.computed(()=>{var p;return!((p=c.value)!=null&&p.validationErrored)}),u=p=>{l.value=p,o("update:value",p,r.index,a)},f=p=>{lt(p),(p.key==="Enter"||p.code==="Enter")&&!r.isLastLine&&(p.preventDefault(),p.stopPropagation())},h=()=>{var p;(p=s.value)==null||p.select()};return t.watch(()=>r.value,p=>{l.value=p}),t.onMounted(()=>{r.autoFocus&&t.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(p,m)=>{const g=ac,b=fo;return t.openBlock(),t.createBlock(t.unref(F.NFormItem),{ref:"form-item-reference",path:n.path,label:`Полоса №${n.index+1}, мм`,class:"sc-hide-empty-feedback-message"},{feedback:t.withCtx(()=>[d.value?(t.openBlock(),t.createBlock($r,{key:0,"is-product-searching":a.value,product:n.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NDropdown),{trigger:"click",options:n.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:t.unref(ct),placeholder:"Введите ширину",onKeydown:f,onInput:m[0]||(m[0]=y=>t.unref(ot)(n.validation,`linesWidths.${n.index}`)),onFocus:t.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),t.createVNode(t.unref(F.NButton),{disabled:n.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[1]||(m[1]=y=>o("click:add-line",n.index))},{default:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["disabled"]),t.createVNode(t.unref(F.NButton),{disabled:n.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[2]||(m[2]=y=>o("click:remove-line",n.index))},{default:t.withCtx(()=>[t.createVNode(b)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),Nb={class:"my-2 flex w-full flex-col"},Tb={key:1},$b={class:"text-lg font-semibold"},Eb={class:"flex gap-3"},Rb={},Mu=t.defineComponent({...Rb,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){var _;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("line-items-reference"),l=t.ref(M.cloneDeep(r.value)),c=t.computed(()=>{const k={length:[le.required,le.min(r.settings.minLength),le.max(r.settings.maxLength),le.step(r.settings.lengthStep),He.serverValidation(r.validation.length.feedback)],quantity:[le.required,le.min(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]};return M.forEach(l.value,(x,v)=>{var B;k[`configuratorParams.linesWidths.${v}`]=[le.required,le.min(r.settings.minLineWidth),le.step(r.settings.lineWidthStep),He.serverValidation((B=r.validation[`linesWidths.${v}`])==null?void 0:B.feedback)]}),k}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((k,x)=>(k??0)+(x??0),0)),f=t.computed(()=>r.settings.width-u.value),h=t.computed(()=>!r.value.some(({product:k})=>!k||k.isNewRec())),p=t.computed(()=>r.isSubmitProcessing||!h.value||f.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(k=>k.product.isNewRec())),m=t.computed(()=>k=>f.value===0?void 0:[{label:`${(f.value>0?"Остаток +":"Излишек ")+f.value} мм.`,key:f.value+k}]),g=t.computed(()=>{const{length:k}=r.value[0];return!k||u.value!==r.settings.width?null:(M.reduce(r.value,(v,B)=>{var T;const w=((T=B.product)==null?void 0:T.costRub)||0;return v+w},0)*r.value[0].quantity*k).toLocaleString("ru-ru",{minimumFractionDigits:2})}),b=(k,x,v)=>{var w,T,C;l.value[x].product.id=-1;const{configuratorParams:B}=l.value[x];B.linesWidths[x]=k,y("configuratorParams",B),(C=(T=(w=a.value)==null?void 0:w.at(x))==null?void 0:T.formItemReference)==null||C.validate().catch(M.noop),t.nextTick(()=>{var $,E;(E=($=a.value)==null?void 0:$.at(x))!=null&&E.isValid&&o("update:params",B,x,v)})},y=(k,x)=>{l.value.forEach(v=>{v[k]=x}),o("update:value",l.value)};return t.watch(()=>r.value,k=>{l.value=M.cloneDeep(k)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(k,x)=>{const v=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:l.value[0],rules:c.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var B;return[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(w,T)=>{var C,$,E;return t.openBlock(),t.createBlock(Vu,{key:T,ref_for:!0,ref:"line-items-reference",value:((C=w.configuratorParams)==null?void 0:C.linesWidths.at(T))??null,"auto-focus":((($=w.configuratorParams)==null?void 0:$.linesWidths.at(T))??0)===0,index:T,path:`configuratorParams.linesWidths.${T}`,product:w.product,settings:n.settings,validation:n.validation,"suggestion-option":m.value(((E=w.configuratorParams)==null?void 0:E.linesWidths.at(T))??0),"add-line-button-disabled":f.value<=0||n.value.length>=n.settings.maxLinesCount||n.value.some(I=>I.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":T===l.value.length-1&&f.value===0,"onUpdate:value":b,"onClick:addLine":x[0]||(x[0]=I=>o("click:add-line",I)),"onClick:removeLine":x[1]||(x[1]=I=>o("click:remove-line",I))},null,8,["value","auto-focus","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled","is-last-line"])}),128)),t.createElementVNode("div",Nb,[f.value<0?(t.openBlock(),t.createBlock(t.unref(F.NText),{key:0,type:"error"},{default:t.withCtx(()=>[t.createTextVNode(" Сумма ширин всех полос должна быть равна "+t.toDisplayString(n.settings.width),1)]),_:1})):t.createCommentVNode("",!0),h.value&&l.value.length===n.settings.maxLinesCount&&f.value>0?(t.openBlock(),t.createBlock(t.unref(F.NText),{key:1,type:"error"},{default:t.withCtx(()=>[...x[15]||(x[15]=[t.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",null,[x[16]||(x[16]=t.createTextVNode(" Остаток для резки: ",-1)),t.createVNode(t.unref(F.NText),{type:f.value>=0?"Success":"error"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.value),1)]),_:1},8,["type"]),t.createTextVNode(" из "+t.toDisplayString(n.settings.width)+" мм ",1)])]),t.createVNode(t.unref(F.NButton),{disabled:p.value,type:"primary",class:"self-center",onClick:x[2]||(x[2]=w=>o("click:add-line",l.value.length))},{default:t.withCtx(()=>[...x[17]||(x[17]=[t.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),t.createVNode(t.unref(F.NFormItem),{path:"length",label:`Метраж ${n.settings.minLength?" от "+n.settings.minLength:""} ${n.settings.maxLength?" до "+n.settings.maxLength:""} м.`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value[0].length,"onUpdate:value":[x[3]||(x[3]=w=>l.value[0].length=w),x[6]||(x[6]=w=>y("length",w))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=w=>t.unref(lt)(w,!1)),onInput:x[5]||(x[5]=w=>t.unref(ot)(n.validation,"length")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[x[7]||(x[7]=w=>l.value[0].quantity=w),x[10]||(x[10]=w=>y("quantity",w))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=w=>t.unref(lt)(w,!1)),onInput:x[9]||(x[9]=w=>t.unref(ot)(n.validation,"quantity")),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:x[11]||(x[11]=w=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":x[12]||(x[12]=w=>{l.value[0].marker=w??null,y("marker",w??null)}),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(v,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=w=>{l.value[0].isAdditionalSale=w??!1,y("isAdditionalSale",w??!1)})},{default:t.withCtx(()=>[...x[18]||(x[18]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createElementBlock("div",Tb,[x[19]||(x[19]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",$b,t.toDisplayString(g.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Eb,[t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:!h.value||f.value!=0||!((B=l.value[0])!=null&&B.length)||l.value[0].length>n.settings.maxLength||l.value[0].length<n.settings.minLength||l.value[0].quantity===0,type:"primary",class:"self-start",onClick:x[14]||(x[14]=w=>o("submit",l.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",l.value)]])}}}),Pb={class:"flex grow flex-col"},Fb=["src"],Vb={class:"w-full"},Mb={},Iu=t.defineComponent({...Mb,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",Pb,[t.createElementVNode("img",{src:"/img/configurators/strip/strip-"+n.value.length+".png",class:"w-full max-w-96 self-center py-5",alt:"Штрипс"},null,8,Fb),t.createElementVNode("div",Vb,[t.createTextVNode(" Число полос можно указать от "+t.toDisplayString(n.settings.minLinesCount)+" до "+t.toDisplayString(n.settings.maxLinesCount)+". ",1),i[0]||(i[0]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Минимальная ширина полосы "+t.toDisplayString(n.settings.minLineWidth)+" мм. ",1),i[1]||(i[1]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина всех полос "+t.toDisplayString(n.settings.width)+" мм. ",1),i[2]||(i[2]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Шаг ширины полосы - "+t.toDisplayString(n.settings.lineWidthStep)+" мм. ",1)])]))}}),Ib={class:"flex flex-col gap-2"},Ab={class:"flex grow flex-col px-5 md:w-104"},Ob={},Au=t.defineComponent({...Ob,__name:"strip-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("strip-configurator-form"),s=t.ref(i.cartItems),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.computed(()=>t.inject("debounce-input-time",300)),d=t.computed(()=>{var m;return(m=s.value[0].configuratorParams)==null?void 0:m.linesWidths.reduce((g,b)=>(g??0)+(b??0),0)}),u=m=>{m===void 0&&(m=s.value.length-1);const g=s.value.at(0);if(!g)return;g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(y=>{y.configuratorParams.linesWidths=g.configuratorParams.linesWidths});const b=new j.OrderItemBase({quantity:(g==null?void 0:g.quantity)??1,category:g==null?void 0:g.category,length:(g==null?void 0:g.length)??i.settings.minLength,marker:g==null?void 0:g.marker,configuratorParams:{linesWidths:g==null?void 0:g.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,b)},f=m=>{const g=s.value.at(0);g&&(g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(b=>{b.configuratorParams.linesWidths=g.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete a[`linesWidths.${m}`],delete a[`linesWidths.${m}`])},h=M.debounce(async(m,g,b)=>{const y={linesWidths:m.linesWidths.at(g)};b.value=!0,a.value[`linesWidths.${g}`]={},s.value[g].product=new j.ClientProduct,i.eventEmitter.emit("configurator:search-product",{category:s.value[g].category,params:y,validationFieldResultData:a.value,callback:_=>{_?(s.value[g].product=_,g===s.value.length-1&&s.value.length<i.settings.maxLinesCount&&d.value&&d.value<i.settings.width&&u()):(s.value[g].product=new j.ClientProduct,a.value[`linesWidths.${g}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},b.value=!1),b.value=!1}})},c.value),p=async()=>{var m,g;(g=(m=o.value)==null?void 0:m.formReference)==null||g.validate(b=>{if(!b){l.value=!0;const y=s.value.at(0);if(!y)return;r("submit",y,a.value,()=>{l.value=!1,t.nextTick(()=>{var _,k;(k=(_=o.value)==null?void 0:_.formReference)==null||k.restoreValidation()})})}}).catch(M.noop)};return t.watch(()=>i.cartItems,m=>{s.value=m.map(g=>new j.OrderItemBase(g))}),(m,g)=>{const b=F.NButton;return t.openBlock(),t.createElementBlock("div",Ib,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(b,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=y=>r("click:view-switch"))},{default:t.withCtx(()=>[...g[3]||(g[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",Ab,[t.createVNode(Iu,{value:s.value,"onUpdate:value":g[1]||(g[1]=y=>s.value=y),settings:n.settings},null,8,["value","settings"]),t.createVNode(Mu,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":g[2]||(g[2]=y=>s.value=y),validation:a.value,settings:n.settings,"is-submit-processing":l.value,"onUpdate:params":t.unref(h),onSubmit:p,"onClick:addLine":u,"onClick:removeLine":f},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),zb={class:"flex flex-col gap-3"},Db={},Ou=t.defineComponent({...Db,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit"],setup(n,{expose:e,emit:i}){var p;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("first-input-element"),l=t.ref(M.cloneDeep(r.value)),c=t.computed(()=>({"configuratorParams.width":[le.required,le.min(r.settings.minWidth),...r.settings.maxWidth?[le.max(r.settings.maxWidth)]:[],le.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[le.required,le.min(r.settings.minLength),le.max(r.settings.maxLength),le.step(1),He.serverValidation(r.validation.length.feedback)],quantity:[le.required,le.min(1),le.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),d=t.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),f("configuratorParams",l.value.configuratorParams)},f=(m,g)=>{const b=new j.OrderItemBase(r.value);b[m]=g,m==="configuratorParams"&&(b.product=new j.ClientProduct),o("update:value",b)},h=()=>{var m;(m=a.value)==null||m.select()};return t.watch(()=>r.value,m=>{l.value=M.cloneDeep(m)},{deep:!0}),t.onMounted(()=>{r.value.isNewRec()&&t.nextTick(()=>{h()})}),e({validate:(p=s.value)==null?void 0:p.validate,formReference:s}),(m,g)=>{const b=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:l.value,rules:c.value,disabled:n.isSubmitProcessing,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${n.settings.minWidth?" от "+n.settings.minWidth:""}${n.settings.maxWidth?" до "+n.settings.maxWidth:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[g[0]||(g[0]=y=>l.value.configuratorParams.width=y),u],class:"w-full",parse:t.unref(ct),"show-button":!1,placeholder:"Введите ширину",onKeydown:g[1]||(g[1]=y=>t.unref(lt)(y)),onInput:g[2]||(g[2]=y=>t.unref(ot)(n.validation,"width")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"configuratorParams.length",label:`Длина, ${n.settings.minLength?" от "+n.settings.minLength:""}${n.settings.maxLength?" до "+n.settings.maxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[g[3]||(g[3]=y=>l.value.configuratorParams.length=y),u],placeholder:"Введите длину",parse:t.unref(ct),"show-button":!1,class:"w-full",onKeydown:g[4]||(g[4]=y=>t.unref(lt)(y)),onInput:g[5]||(g[5]=y=>t.unref(ot)(n.validation,"length")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:n.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:g[6]||(g[6]=y=>t.unref(lt)(y,!1)),onInput:g[7]||(g[7]=y=>t.unref(ot)(n.validation,"quantity")),"onUpdate:value":g[8]||(g[8]=y=>f("quantity",y??0)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:n.value.marker??null,placeholder:"Введите маркировку",onInput:g[9]||(g[9]=y=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":g[10]||(g[10]=y=>f("marker",y??null)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(b,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":g[11]||(g[11]=y=>{l.value.isAdditionalSale=y??!1,f("isAdditionalSale",y??!1)})},{default:t.withCtx(()=>[...g[13]||(g[13]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode($r,{"is-product-searching":n.isProductSearching,product:n.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),t.createElementVNode("div",zb,[t.createVNode(t.unref(F.NButton),{disabled:n.value.product.isNewRec()||n.isProductSearching||n.isSubmitProcessing||n.value.length===0||n.value.width===0||n.value.quantity===0,type:"primary",class:"self-start",onClick:g[12]||(g[12]=y=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])),[[t.unref(oi),()=>o("submit",l.value)]])}}}),Lb={class:"flex flex-col gap-2 w-72"},Hb={},zu=t.defineComponent({...Hb,__name:"metal-for-doors-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("metal-for-doors-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.ref(!1),d=t.computed(()=>t.inject("debounce-input-time",300)),u=M.debounce(async h=>{var p,m;s.value.product=new j.ClientProduct,(m=(p=o.value)==null?void 0:p.formReference)==null||m.validate(g=>{g||(l.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:h,validationFieldResultData:a.value,callback:b=>{b?s.value.product=b:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(M.noop)},d.value),f=async()=>{var h,p;(p=(h=o.value)==null?void 0:h.formReference)==null||p.validate(m=>{m||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})}))}).catch(M.noop)};return t.watch(()=>i.cartItem,h=>{s.value=new j.OrderItemBase(h)},{deep:!0}),(h,p)=>{const m=F.NButton;return t.openBlock(),t.createElementBlock("div",Lb,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=g=>r("click:view-switch"))},{default:t.withCtx(()=>[...p[4]||(p[4]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(Ou,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":p[1]||(p[1]=g=>s.value=g),validation:a.value,settings:n.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":p[2]||(p[2]=g=>t.unref(u)(g)),onSubmit:p[3]||(p[3]=g=>f())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),Wb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function jb(n,e){return t.openBlock(),t.createElementBlock("svg",Wb,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 112v288m144-144H112"},null,-1)])])}const Du=t.markRaw({name:"ion-add",render:jb}),qb={key:0,class:"-mt-1 text-sm text-gray-500"},Xb={class:"font-bold"},Yb={class:"flex flex-col gap-3"},Ub={key:0,class:"mt-4 flex flex-col gap-1.5"},Kb={class:"flex flex-col gap-1 text-sm text-gray-700"},Gb={key:0},Zb={key:1},Qb={"form-array-name":"items",class:"flex flex-col gap-3"},Jb={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},e_={key:0,class:"flex flex-wrap items-end gap-2"},t_={class:"whitespace-nowrap text-xl font-bold"},n_={key:0,class:"whitespace-nowrap text-lg text-gray-500"},i_={class:"font-bold"},r_={class:"font-bold"},o_={class:"flex gap-3"},s_={},Lu=t.defineComponent({...s_,__name:"sandwich-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","add-item","remove-item"],setup(n,{expose:e,emit:i}){var D;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(M.cloneDeep(r.value)),l=t.ref({...r.validation}),c=L=>{var z;delete l.value[L],(z=s.value)==null||z.restoreValidation()};t.watch(()=>r.validation,L=>{l.value={...L},Object.values(L).some(P=>P==null?void 0:P.feedback)&&t.nextTick(()=>{var P;return(P=s.value)==null?void 0:P.validate(M.noop).catch(M.noop)})},{deep:!0});const d=t.computed(()=>r.value.category),u=t.ref(null),f=t.ref(null),h=t.computed(()=>d.value.products??[]),p=t.computed(()=>h.value.map(L=>({label:L.name,value:L.id}))),m=(L,z,P)=>{const q=L!=null&&L>0,K=z!=null&&z>0;return!q&&!K?null:q&&K?`от ${L} ${P} до ${z} ${P}`:q?`от ${L} ${P}`:`до ${z} ${P}`},g=t.computed(()=>{var L,z;return m(r.settings.minWidth,(z=(L=u.value)==null?void 0:L.properties)==null?void 0:z.width,"мм")}),b=t.computed(()=>{var L,z;return m(r.settings.minLength,(z=(L=u.value)==null?void 0:L.properties)==null?void 0:z.length,"мм")}),y=t.ref(null),_=t.ref(!1),k=t.computed(()=>{var z;const L={marker:[He.serverValidation((z=l.value.marker)==null?void 0:z.feedback)]};return a.value.configuratorParams.items.forEach((P,q)=>{var K,J,Y,V,A,ie,ce;L[`configuratorParams.items.${q}.width`]=[le.required,le.min(r.settings.minWidth),...(J=(K=u.value)==null?void 0:K.properties)!=null&&J.width?[le.max(u.value.properties.width)]:[],le.step(1),He.serverValidation((Y=l.value[`items.${q}.width`])==null?void 0:Y.feedback)],L[`configuratorParams.items.${q}.length`]=[le.required,le.min(r.settings.minLength),...(A=(V=u.value)==null?void 0:V.properties)!=null&&A.length?[le.max(u.value.properties.length)]:[],le.step(1),He.serverValidation((ie=l.value[`items.${q}.length`])==null?void 0:ie.feedback)],L[`configuratorParams.items.${q}.count`]=[le.required,le.min(1),le.step(1),He.serverValidation((ce=l.value[`items.${q}.count`])==null?void 0:ce.feedback)]}),L}),x=t.ref(r.settings.canSetDopProdaga??!1),v=t.computed(()=>a.value.configuratorParams.items.some(L=>{var z,P;return!u.value||!L.width||L.width<r.settings.minWidth||L.width>(((z=u.value.properties)==null?void 0:z.width)??0)||L.length===0||L.length<r.settings.minLength||L.length>(((P=u.value.properties)==null?void 0:P.length)??0)||!L.count||L.count<1})),B=t.computed(()=>!u.value||v.value||a.value.configuratorParams.items.length===0),w=t.ref(null),T=L=>{if(!L){u.value=null,f.value=null,a.value.product=new j.ClientProduct,y.value=null;return}const z=h.value.find(P=>P.id===L);z&&(u.value=z,f.value=L,a.value.product=z,G("product",a.value.product),a.value.configuratorParams.items.forEach(P=>{var q,K;(q=z.properties)!=null&&q.width&&P.width>z.properties.width&&(P.width=z.properties.width),(K=z.properties)!=null&&K.length&&P.length>z.properties.length&&(P.length=z.properties.length)}),$())};let C=!1;const $=()=>{C=!0,y.value=null,w.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},E=async()=>{var L;if(!u.value||a.value.configuratorParams.items.length===0||v.value){$();return}(L=s.value)==null||L.validate(z=>{if(z){$();return}if(_.value=!0,!u.value||!d.value){$(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:P=>{P?(y.value=P,a.value.configuratorParams.calculationId=P.id,a.value.quantity=P.quantity,t.nextTick(()=>{G("quantity",P.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,$()),G("configuratorParams",a.value.configuratorParams),I(),_.value=!1}})}).catch(()=>{$(),_.value=!1})},I=()=>{var z;if(!((z=u.value)!=null&&z.costRub)||!y.value){w.value=null;return}const L=y.value.quantity*u.value.costRub;w.value=Math.round(L*100)/100},R=L=>{var P,q;const z=a.value.configuratorParams.items[L];u.value&&((P=u.value.properties)!=null&&P.width&&z.width>u.value.properties.width&&(z.width=u.value.properties.width),(q=u.value.properties)!=null&&q.length&&z.length>u.value.properties.length&&(z.length=u.value.properties.length)),G("configuratorParams",a.value.configuratorParams),$()},O=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),G("configuratorParams",a.value.configuratorParams),$(),o("add-item",a.value.configuratorParams.items.length)},U=L=>{a.value.configuratorParams.items.splice(L,1),G("configuratorParams",a.value.configuratorParams),$(),o("remove-item",L)},Q=()=>{if(!(B.value||_.value||r.isSubmitProcessing)){if(!y.value){E();return}o("submit",a.value)}},G=(L,z)=>{const P=new j.OrderItemBase(r.value);P[L]=z,o("update:value",P)};t.watch(()=>r.value,L=>{const z=M.cloneDeep(t.toRaw(L));(!z.configuratorParams.items||z.configuratorParams.items.length===0)&&(z.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=z,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),r.value.product.isNewRec()&&(u.value=null,f.value=null),C?C=!1:W()},{deep:!0});const W=()=>{const{calculationId:L}=a.value.configuratorParams,z=a.value.quantity??0;L&&z>0&&a.value.product&&!a.value.product.isNewRec()&&(y.value={id:L,quantity:z,sheets:[]},I())};return t.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),W()}),e({validate:(D=s.value)==null?void 0:D.validate,formReference:s}),(L,z)=>{const P=fo,q=Du;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:a.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var K;return[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:f.value,"onUpdate:value":[z[0]||(z[0]=J=>f.value=J),T],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((K=u.value)==null?void 0:K.costRub)!=null?(t.openBlock(),t.createElementBlock("div",qb,[t.createElementVNode("span",Xb,t.toDisplayString(u.value.code),1),t.createTextVNode(" — "+t.toDisplayString(u.value.costRub.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol)+"/шт. ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Yb,[u.value?(t.openBlock(),t.createElementBlock("div",Ub,[z[7]||(z[7]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",Kb,[g.value?(t.openBlock(),t.createElementBlock("div",Gb,"Ширина "+t.toDisplayString(g.value)+".",1)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock("div",Zb,"Длина "+t.toDisplayString(b.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",Qb,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value.configuratorParams.items,(J,Y)=>(t.openBlock(),t.createElementBlock("div",{key:Y,class:"flex grow gap-2"},[t.createElementVNode("div",Jb,[t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.width`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].width,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].width=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:z[1]||(z[1]=V=>t.unref(lt)(V)),onInput:V=>c(`items.${Y}.width`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.length`,label:"Длина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].length,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].length=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:z[2]||(z[2]=V=>t.unref(lt)(V)),onInput:V=>c(`items.${Y}.length`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.count`,label:"Количество, шт"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].count,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].count=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:z[3]||(z[3]=V=>t.unref(lt)(V,!1)),onInput:V=>c(`items.${Y}.count`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(F.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:V=>U(Y)},{default:t.withCtx(()=>[t.createVNode(P)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:1,disabled:v.value,type:"default",class:"self-center",onClick:O},{default:t.withCtx(()=>[t.createVNode(q),z[8]||(z[8]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка распила"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:z[4]||(z[4]=J=>c("marker")),"onUpdate:value":z[5]||(z[5]=J=>G("marker",J??null)),onFocus:t.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),x.value?(t.openBlock(),t.createBlock(t.unref(F.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":z[6]||(z[6]=J=>{a.value.isAdditionalSale=J??!1,G("isAdditionalSale",J??!1)})},{default:t.withCtx(()=>[...z[9]||(z[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(t.unref(F.NSpin),{show:_.value,size:"small",class:"grow"},{default:t.withCtx(()=>{var J;return[y.value&&u.value&&w.value?(t.openBlock(),t.createElementBlock("div",e_,[t.createElementVNode("div",null,[z[10]||(z[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",t_,t.toDisplayString(w.value.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol),1)]),y.value.quantity&&u.value?(t.openBlock(),t.createElementBlock("div",n_,[t.createElementVNode("span",i_,"("+t.toDisplayString(y.value.quantity)+" шт.",1),z[11]||(z[11]=t.createTextVNode(" x ",-1)),t.createElementVNode("span",r_,t.toDisplayString((J=u.value.costRub)==null?void 0:J.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]}),_:1},8,["show"]),t.createElementVNode("div",o_,[y.value&&!_.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,loading:n.isSubmitProcessing,disabled:B.value||_.value,type:"primary",class:"self-start",onClick:Q},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:1,loading:_.value,disabled:B.value||_.value,type:"info",class:"self-start",onClick:E},{default:t.withCtx(()=>[...z[12]||(z[12]=[t.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[t.unref(oi),Q]])}}}),a_={class:"flex flex-col gap-2"},l_={class:"w-104 flex grow flex-col px-5"},c_={},Hu=t.defineComponent({...c_,__name:"sandwich-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{},product:{}}),l=t.ref(!1),c=async()=>{var f,h;(h=(f=o.value)==null?void 0:f.formReference)==null||h.validate(p=>{if(!p){l.value=!0;const m=M.cloneDeep(s.value);"items"in m.configuratorParams&&delete m.configuratorParams.items,r("submit",m,a.value,()=>{l.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})})}}).catch(M.noop)},d=f=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}},u=f=>{delete a.value[`items.${f}.width`],delete a.value[`items.${f}.length`],delete a.value[`items.${f}.count`]};return t.onMounted(()=>{i.cartItem.configuratorParams.items.forEach((f,h)=>{a.value[`items.${h}.width`]={},a.value[`items.${h}.length`]={},a.value[`items.${h}.count`]={}})}),t.watch(()=>i.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,h)=>{const p=F.NButton;return t.openBlock(),t.createElementBlock("div",a_,[n.settings.allowShowTable&&s.value.isNewRec()?(t.openBlock(),t.createBlock(p,{key:0,type:"tertiary",class:"self-center",onClick:h[0]||(h[0]=m=>r("click:view-switch"))},{default:t.withCtx(()=>[...h[2]||(h[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",l_,[t.createVNode(Lu,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":h[1]||(h[1]=m=>s.value=m),validation:a.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":l.value,onSubmit:c,onAddItem:d,onRemoveItem:u},null,8,["value","validation","settings","event-emitter","is-submit-processing"])])])}}}),d_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function u_(n,e){return t.openBlock(),t.createElementBlock("svg",d_,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1)])])}const f_=t.markRaw({name:"ion-checkmark",render:u_}),h_={key:0,class:"-mt-1 text-sm text-gray-500"},m_={class:"font-bold"},p_={class:"flex flex-col gap-3"},g_={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},y_={class:"flex flex-col gap-1 text-sm text-gray-700"},b_={key:0},__={key:1},w_={"form-array-name":"items",class:"flex flex-col gap-3"},x_={class:"min-w-0 flex-1"},k_={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},C_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},v_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},S_={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},B_={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},N_={key:0,class:"lg:!flex-[2]"},T_={class:"font-bold"},$_={key:1,class:"lg:!flex-[3]"},E_={class:"font-bold"},R_={key:1,class:"min-w-0 flex flex-col items-end gap-1 text-right text-sm text-gray-700 border-t border-gray-200 pt-2"},P_={key:0},F_={class:"font-bold"},V_={key:1},M_={class:"font-bold"},I_={class:"flex flex-wrap items-center gap-3"},A_={},Wu=t.defineComponent({...A_,__name:"sandwich-m2-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},itemStates:{default:()=>[]}},emits:["submit","update:value","add-item","remove-item","item-reset"],setup(n,{expose:e,emit:i}){var J;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("widthInputs"),l=r.value==null?[]:M.cloneDeep(t.toRaw(r.value)),c=t.ref(l.map(Y=>new j.OrderItemBase(Y))),d=t.computed(()=>({items:c.value})),u=t.ref({...r.validation}),f=Y=>{var V;delete u.value[Y],(V=s.value)==null||V.restoreValidation()},h=t.ref(null),p=t.ref(null),m=t.computed(()=>{var Y,V;return((V=(Y=c.value[0])==null?void 0:Y.category)==null?void 0:V.products)??[]}),g=t.computed(()=>m.value.map(Y=>({label:Y.name,value:Y.id}))),b=(Y,V,A)=>{const ie=Y!=null&&Y>0,ce=V!=null&&V>0;return!ie&&!ce?null:ie&&ce?`от ${Y} ${A} до ${V} ${A}`:ie?`от ${Y} ${A}`:`до ${V} ${A}`},y=t.computed(()=>{var Y,V;return b(r.settings.minWidth,(V=(Y=h.value)==null?void 0:Y.properties)==null?void 0:V.width,"мм")}),_=t.computed(()=>{var Y,V;return b(r.settings.minLength,(V=(Y=h.value)==null?void 0:Y.properties)==null?void 0:V.length,"мм")}),k=t.computed(()=>{const Y={};return c.value.forEach((V,A)=>{var ie,ce,pe,at,we,ke,kt,Ne;Y[`items.${A}.configuratorParams.width`]=[le.required,le.min(r.settings.minWidth),...(ce=(ie=h.value)==null?void 0:ie.properties)!=null&&ce.width?[le.max(h.value.properties.width)]:[],le.step(1),He.serverValidation((pe=u.value[`items.${A}.width`])==null?void 0:pe.feedback)],Y[`items.${A}.configuratorParams.length`]=[le.required,le.min(r.settings.minLength),...(we=(at=h.value)==null?void 0:at.properties)!=null&&we.length?[le.max(h.value.properties.length)]:[],le.step(1),He.serverValidation((ke=u.value[`items.${A}.length`])==null?void 0:ke.feedback)],Y[`items.${A}.quantity`]=[le.required,le.min(1),le.step(1),He.serverValidation((kt=u.value[`items.${A}.quantity`])==null?void 0:kt.feedback)],Y[`items.${A}.marker`]=[He.serverValidation((Ne=u.value[`items.${A}.marker`])==null?void 0:Ne.feedback)]}),Y});t.watch(()=>r.validation,Y=>{u.value={...Y},Object.values(Y).some(A=>A==null?void 0:A.feedback)&&t.nextTick(()=>{var A;return(A=s.value)==null?void 0:A.validate(M.noop).catch(M.noop)})},{deep:!0});const x=t.ref(r.settings.canSetDopProdaga??!1),v=t.computed(()=>{const Y=h.value;return Y?c.value.some(V=>{var pe,at;const A=V.configuratorParams,ie=(pe=Y.properties)==null?void 0:pe.width,ce=(at=Y.properties)==null?void 0:at.length;return A.width===0||A.width<r.settings.minWidth||ie!=null&&A.width>ie||A.length===0||A.length<r.settings.minLength||ce!=null&&A.length>ce||V.quantity===0||V.quantity<1}):!0}),B=t.computed(()=>!h.value||v.value||c.value.length===0),w=t.computed(()=>{const Y=c.value[0];return Y!=null&&!Y.isNewRec()}),T=Y=>r.itemStates[Y]??"idle",C=Y=>T(Y)==="success",$=Y=>T(Y)==="loading",E=t.computed(()=>c.value.length===0?!0:c.value.every((Y,V)=>{const A=T(V);return A==="success"||A==="loading"})),I=Y=>Y.width===0||Y.length===0?0:Y.width*Y.length/1e6,R=Y=>I(Y).toLocaleString(void 0,{maximumFractionDigits:4}),O=Y=>{var pe;const V=Y.configuratorParams,A=I(V),ie=((pe=h.value)==null?void 0:pe.costRub)??0,ce=Y.quantity??0;return!A||!ce?0:Math.round(A*ie*ce*100)/100},U=t.computed(()=>M.sum(c.value.map(Y=>{const V=Y.configuratorParams;return!V.width||V.length===0||!Y.quantity?0:V.width*V.length*Y.quantity/1e6}))),Q=t.computed(()=>Math.round(M.sum(c.value.map(Y=>O(Y)))*100)/100),G=()=>{var Y,V,A;return new j.OrderItemBase({category:(Y=c.value[0])==null?void 0:Y.category,configurator:(V=c.value[0])==null?void 0:V.configurator,product:h.value??new j.ClientProduct,quantity:1,isAdditionalSale:(A=c.value[0])==null?void 0:A.isAdditionalSale,configuratorParams:{width:0,length:0}})},W=Y=>{if(!Y){h.value=null,p.value=null,c.value.forEach(A=>{A.product=new j.ClientProduct}),o("update:value",c.value);return}const V=m.value.find(A=>A.id===Y);V&&(h.value=V,p.value=Y,c.value.forEach((A,ie)=>{var ce,pe;A.product=V,(ce=V.properties)!=null&&ce.width&&A.configuratorParams.width>V.properties.width&&(A.configuratorParams.width=V.properties.width),(pe=V.properties)!=null&&pe.length&&A.configuratorParams.length>V.properties.length&&(A.configuratorParams.length=V.properties.length),o("item-reset",ie)}),o("update:value",c.value))},D=Y=>{var ie,ce;const V=c.value[Y],A=h.value;A&&((ie=A.properties)!=null&&ie.width&&V.configuratorParams.width>A.properties.width&&(V.configuratorParams.width=A.properties.width),(ce=A.properties)!=null&&ce.length&&V.configuratorParams.length>A.properties.length&&(V.configuratorParams.length=A.properties.length)),o("item-reset",Y),o("update:value",c.value)},L=(Y,V)=>{c.value[Y].marker=V===null||V===""?void 0:V,o("item-reset",Y),o("update:value",c.value)},z=Y=>{c.value.forEach(V=>{V.isAdditionalSale=Y}),o("update:value",c.value)},P=()=>{c.value.push(G()),o("update:value",c.value),o("add-item",c.value.length),t.nextTick(()=>{var V,A,ie,ce;const Y=c.value.length-1;(A=(V=a.value)==null?void 0:V[Y])==null||A.focus(),(ce=(ie=a.value)==null?void 0:ie[Y])==null||ce.select()})},q=Y=>{c.value.splice(Y,1),o("update:value",c.value),o("remove-item",Y)};t.watch(()=>r.value,Y=>{var ce;const A=(Y==null?[]:M.cloneDeep(t.toRaw(Y))).map(pe=>new j.OrderItemBase(pe));c.value=A.length>0?A:[G()];const ie=(ce=c.value[0])==null?void 0:ce.product;ie&&!ie.isNewRec()?(h.value=ie,p.value=ie.id):(h.value=null,p.value=null)},{deep:!0});const K=()=>{var V;if(h.value!==null)return;const Y=(V=m.value[0])==null?void 0:V.id;Y!=null&&W(Y)};return t.watch(m,()=>{K()}),t.onMounted(()=>{var V;c.value.length===0&&(c.value=[G()]);const Y=(V=c.value[0])==null?void 0:V.product;Y&&!Y.isNewRec()&&(h.value=Y,p.value=Y.id),K()}),e({validate:(J=s.value)==null?void 0:J.validate,formReference:s}),(Y,V)=>{const A=f_,ie=fo,ce=Du;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:d.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var pe,at;return[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:p.value,"onUpdate:value":[V[0]||(V[0]=we=>p.value=we),W],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((pe=h.value)==null?void 0:pe.costRub)!=null?(t.openBlock(),t.createElementBlock("div",h_,[t.createElementVNode("span",m_,t.toDisplayString(h.value.code),1),t.createTextVNode(" — "+t.toDisplayString(h.value.costRub.toLocaleString())+" "+t.toDisplayString(h.value.currency.symbol)+"/м² ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",p_,[h.value?(t.openBlock(),t.createElementBlock("div",g_,[V[6]||(V[6]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",y_,[y.value?(t.openBlock(),t.createElementBlock("div",b_,"Ширина "+t.toDisplayString(y.value)+".",1)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock("div",__,"Длина "+t.toDisplayString(_.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",w_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value.items,(we,ke)=>{var kt;return t.openBlock(),t.createElementBlock("div",{key:ke,class:t.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",C(ke)?"opacity-70":""])},[t.createElementVNode("div",x_,[t.createElementVNode("div",k_,[t.createElementVNode("div",C_,[t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[ke].configuratorParams.width,"onUpdate:value":[Ne=>d.value.items[ke].configuratorParams.width=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Ширина",class:"w-full",onKeydown:V[1]||(V[1]=Ne=>t.unref(lt)(Ne)),onInput:Ne=>f(`items.${ke}.width`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:d.value.items[ke].configuratorParams.length,"onUpdate:value":[Ne=>d.value.items[ke].configuratorParams.length=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Длина",class:"w-full",onKeydown:V[2]||(V[2]=Ne=>t.unref(lt)(Ne)),onInput:Ne=>f(`items.${ke}.length`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createElementVNode("div",v_,[t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:d.value.items[ke].quantity,"onUpdate:value":[Ne=>d.value.items[ke].quantity=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Кол-во",class:"w-full",onKeydown:V[3]||(V[3]=Ne=>t.unref(lt)(Ne,!1)),onInput:Ne=>f(`items.${ke}.quantity`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.marker`,label:"Маркировка",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:d.value.items[ke].marker??null,disabled:!h.value||C(ke)||$(ke),placeholder:"Маркировка",class:"w-full",onInput:Ne=>f(`items.${ke}.marker`),"onUpdate:value":Ne=>L(ke,Ne??null),onFocus:t.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),$(ke)||C(ke)?(t.openBlock(),t.createElementBlock("div",S_,[$(ke)?(t.openBlock(),t.createBlock(t.unref(F.NSpin),{key:0,size:14})):C(ke)?(t.openBlock(),t.createBlock(A,{key:1,class:"text-green-600 text-xl"})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",B_,[we.configuratorParams.width>0&&we.configuratorParams.length>0?(t.openBlock(),t.createElementBlock("div",N_,[V[7]||(V[7]=t.createTextVNode(" Площадь (S) = ",-1)),t.createElementVNode("span",T_,t.toDisplayString(R(we.configuratorParams))+" м²",1)])):t.createCommentVNode("",!0),O(we)>0?(t.openBlock(),t.createElementBlock("div",$_,[V[8]||(V[8]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",E_,t.toDisplayString(O(we).toLocaleString())+" "+t.toDisplayString((kt=h.value)==null?void 0:kt.currency.symbol),1)])):t.createCommentVNode("",!0)])]),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,disabled:$(ke)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Ne=>q(ke)},{default:t.withCtx(()=>[t.createVNode(ie)]),_:1},8,["disabled","onClick"]))],2)}),128))]),h.value?(t.openBlock(),t.createElementBlock("div",R_,[U.value>0?(t.openBlock(),t.createElementBlock("div",P_,[V[9]||(V[9]=t.createTextVNode(" Общая площадь: ",-1)),t.createElementVNode("span",F_,t.toDisplayString(U.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):t.createCommentVNode("",!0),Q.value>0?(t.openBlock(),t.createElementBlock("div",V_,[V[10]||(V[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",M_,t.toDisplayString(Q.value.toLocaleString())+" "+t.toDisplayString(h.value.currency.symbol),1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),x.value?(t.openBlock(),t.createBlock(t.unref(F.NCheckbox),{key:1,checked:((at=c.value[0])==null?void 0:at.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":V[4]||(V[4]=we=>z(we??!1))},{default:t.withCtx(()=>[...V[11]||(V[11]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createElementVNode("div",I_,[h.value&&!w.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,disabled:v.value,type:"default",onClick:P},{default:t.withCtx(()=>[t.createVNode(ce),V[12]||(V[12]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:B.value||E.value,type:"primary",class:"ml-auto",onClick:V[5]||(V[5]=we=>o("submit",c.value))},{default:t.withCtx(()=>{var we;return[t.createTextVNode(t.toDisplayString((we=c.value[0])!=null&&we.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",c.value)]])}}}),O_={class:"flex flex-col gap-2"},z_={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},D_={},ju=t.defineComponent({...D_,__name:"sandwich-m2-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["click:view-switch","submit"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-m2-configurator-form"),s=t.ref((i.cartItems??[]).map(k=>new j.OrderItemBase(k))),a=t.ref([]),l=t.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=k=>{c.forEach(x=>{l.value[`items.${k}.${x}`]={}})},u=k=>{c.forEach(x=>{delete l.value[`items.${k}.${x}`]})},f=t.computed(()=>a.value.includes("loading")),h=()=>({width:{},length:{},quantity:{},marker:{}}),p=(k,x)=>{let v=!1;return c.forEach(B=>{var I,R;const w=`items.0.${B}`,T=(I=k[B])==null?void 0:I.feedback,$=((R=k[w])==null?void 0:R.feedback)??T,E=`items.${x}.${B}`;$?(l.value[E]=k[w]??k[B],v=!0):l.value[E]={}}),v},m=(k,x,v)=>new Promise(B=>{const w=h();let T=!1;const C=$=>{if(T)return;T=!0;const E=p(w,x),I=($===void 0?!E:$)&&!E;a.value[x]=I?"success":"error",t.nextTick(()=>{var R,O;(O=(R=o.value)==null?void 0:R.formReference)==null||O.restoreValidation()}),B(I)};a.value[x]="loading",r("submit",[M.cloneDeep(k)],w,C,{isFinalSuccessfulCompletion:v})}),g=async()=>{var v,B;try{await((B=(v=o.value)==null?void 0:v.formReference)==null?void 0:B.validate())}catch{return}const k=s.value.map((w,T)=>T).filter(w=>{const T=a.value[w]??"idle";return T!=="success"&&T!=="loading"});let x=!0;for(let w=0;w<k.length;w+=1){const T=k[w],C=s.value[T];if(!C)break;const E=w===k.length-1&&x;await m(C,T,E)||(x=!1)}},b=k=>{const x=k-1;a.value[x]="idle",d(x)},y=k=>{a.value.splice(k,1),u(k);for(let x=k;x<s.value.length;x+=1)d(x)},_=k=>{const x=a.value[k];(x==="success"||x==="error")&&(a.value[k]="idle")};return t.onMounted(()=>{(i.cartItems??[]).forEach((k,x)=>{a.value[x]="idle",d(x)})}),t.watch(()=>i.cartItems,k=>{const x=(k??[]).map(v=>new j.OrderItemBase(v));s.value=x,a.value=x.map(()=>"idle"),x.forEach((v,B)=>{d(B)})},{deep:!0}),(k,x)=>{var B;const v=F.NButton;return t.openBlock(),t.createElementBlock("div",O_,[n.settings.allowShowTable&&((B=s.value[0])!=null&&B.isNewRec())?(t.openBlock(),t.createBlock(v,{key:0,type:"tertiary",class:"self-center",onClick:x[0]||(x[0]=w=>r("click:view-switch"))},{default:t.withCtx(()=>[...x[2]||(x[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",z_,[t.createVNode(Wu,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":x[1]||(x[1]=w=>s.value=w),validation:l.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":f.value,"item-states":a.value,onSubmit:g,onAddItem:b,onRemoveItem:y,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),L_={key:0,class:"flex justify-center p-4"},H_={key:1,class:"p-4 text-center text-red-500"},W_={key:2,class:"flex justify-center"},j_={class:"!bg-white p-4 m-2 rounded-md w-max"},q_={key:3,class:"p-4 text-center text-gray-500"},X_={},qu=t.defineComponent({...X_,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},cartItems:{},category:{}},setup(n){const e=n,i=t.ref(!1),r=t.ref(null),o=t.ref(e.cartItem??null),s=t.ref(e.cartItems??null),a=h=>{const p=h.configuratorParams;return[new j.OrderItemBase({...h,quantity:h.quantity??1,marker:h.marker,configuratorParams:{width:(p==null?void 0:p.width)??h.width??0,length:(p==null?void 0:p.length)??h.length??0}})]},l=t.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var p,m,g;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const h={category:((p=e.cartItem)==null?void 0:p.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:M.some(b.startTailConfigs,y=>y.isDefault)?(m=b.startTailConfigs)==null?void 0:m.findIndex(y=>y.isDefault):void 0,endTailType:M.some(b.endTailConfigs,y=>y.isDefault)?(g=b.endTailConfigs)==null?void 0:g.findIndex(y=>y.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{width:0,height:0,netType:b.netType[0]||"",color:b.color[0]||"",mountType:b.mountType[0]||""}});break}case"strip":{const b=e.settings;s.value=[new j.OrderItemBase({...h,length:b.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{width:b.minWidth,length:b.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...h,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...h,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(h,p,m)=>{const g=b=>{m==null||m(),b&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:h,callback:g,validation:p})},u=(h,p,m,g)=>{const b=h[0];if(!b){m==null||m();return}const y=(g==null?void 0:g.isFinalSuccessfulCompletion)===!0,_=k=>{m==null||m(k),y&&k&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:b,callback:_,validation:p,additionalParams:g})},f=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return t.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(h,p)=>{const m=F.NSpin;return t.openBlock(),t.createElementBlock(t.Fragment,null,[i.value?(t.openBlock(),t.createElementBlock("div",L_,[t.createVNode(m,{size:"large"})])):r.value?(t.openBlock(),t.createElementBlock("div",H_,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0),n.settings!==null&&(o.value!==null||s.value!==null||l.value!==null)?(t.openBlock(),t.createElementBlock("div",W_,[t.createElementVNode("div",j_,[n.editor==="kozyrek"?(t.openBlock(),t.createBlock(Eu,{key:0,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="mosquitto"?(t.openBlock(),t.createBlock(Fu,{key:1,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="strip"?(t.openBlock(),t.createBlock(Au,{key:2,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":s.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):n.editor==="metal_for_doors"?(t.openBlock(),t.createBlock(zu,{key:3,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich"?(t.openBlock(),t.createBlock(Hu,{key:4,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich_m2"?(t.openBlock(),t.createBlock(ju,{key:5,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":l.value,"onClick:viewSwitch":f,onSubmit:u},null,8,["event-emitter","settings","cart-items"])):t.createCommentVNode("",!0)])])):(t.openBlock(),t.createElementBlock("div",q_,' Конфигуратор "'+t.toDisplayString(n.editor)+'" не поддерживается. ',1))],64)}}});function Xu(n){return Object.values(j.ConfiguratorsEnum).includes(n)}function Yu(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:n.properties.configuratorSettings!==void 0&&M.isArray(n.products)&&n.products.length>0}const Y_={key:0,class:"pt-0.5"},U_={key:0},K_={class:"line-through"},G_={key:0},Z_={key:1},Q_={class:"flex flex-row gap-1"},J_={key:0},ew={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},tw={class:"flex flex-col gap-2.5 sm:flex-row"},nw={key:0,class:"header-extra"},iw={class:"inline-flex"},rw={class:"inline-flex"},ow={class:"inline-flex"},sw={class:"mt-2"},aw={key:1,class:"flex flex-col"},lw={},cw=t.defineComponent({...lw,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},isCategoryItemSelected:{type:[Boolean,String,Function],default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function],default:!1},showCategoryRequiredButton:{type:[Boolean,String,Function],default:!1},showCategoryPinButton:{type:[Boolean,String,Function],default:!1},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function],default:!1},canShowConfigurator:{type:[Boolean,Function],default:!1},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(n){const e=n,i=t.inject(Br,"medium"),r=t.computed(()=>{var V;return(V=e==null?void 0:e.filteredItems)==null?void 0:V[e.categoryItem.id]}),o=t.computed(()=>{var V,A;return M.isArray((V=e.categoryItem)==null?void 0:V.categories)&&((A=e.categoryItem.categories)==null?void 0:A.length)>0}),s=t.computed(()=>{var V;return M.isArray((V=e.categoryItem)==null?void 0:V.products)?e.categoryItem.products:[]}),a=t.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([V,A])=>`${A} руб./${O(V)}`).join(", ")),l=t.computed(()=>M.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(V=>{var ie;const A=(ie=r.value)==null?void 0:ie.products;return M.isArray(A)&&A.includes(V.id)})),c=t.computed(()=>l.value.length>0),d=t.computed(()=>M.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=t.computed(()=>M.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),f=t.computed(()=>M.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),h=t.computed(()=>{var ie,ce;const V=(ie=k.value)==null?void 0:ie.hidingComment,A=(ce=k.value)!=null&&ce.isDisabled?`Скрыто для клиента${V?`. Причина: '${V}'`:""}`:"Видимо клиенту";return d.value==="disabled"?`${A}. ${kr}`:A}),p=t.computed(()=>{var ie;const V=(ie=k.value)==null?void 0:ie.manager,A=V?`Категория закреплена за "${V.name??"-"}"`:"Закрепить";return u.value==="disabled"?`${A}. ${kr}`:A}),m=t.computed(()=>f.value==="disabled"?`${Cs}. ${kr}`:Cs),g=t.computed(()=>M.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),b=t.computed(()=>{var V,A,ie;return((V=e.categoryItem.properties)==null?void 0:V.configurator)!==void 0&&Xu((A=e.categoryItem.properties)==null?void 0:A.configurator)&&Yu(e.categoryItem)&&((ie=e.categoryItem.properties)==null?void 0:ie.configuratorSettings)!==void 0&&(M.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),y=t.computed(()=>b.value&&(M.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),_=t.computed(()=>M.isNil(e.categoryContextButtonsConfig)?[]:M.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),k=t.computed(()=>new j.ClientCategory(e.categoryItem)),x=t.ref(!1),v=t.ref(!1),B=t.computed(()=>!M.isUndefined(e.isCategoryItemSelected)),w=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),T=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),C=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),$=t.computed(()=>K.value&&Xe.getDeviceTypeByResolution()===je.laptop?"auto":"fixed"),E=t.useTemplateRef("collapse-item-reference"),I=t.computed(()=>{var V,A;return(A=(V=e.categoryItem.properties)==null?void 0:V.templateCost)==null?void 0:A.priceCoefficient}),R=t.computed(()=>{var V,A;return(A=(V=e.categoryItem.properties)==null?void 0:V.templateCost)==null?void 0:A.increasePercent}),O=(V,A="ru-RU")=>0 .toLocaleString(A,{style:"currency",currency:V,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),U=V=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:V,target:E.value})},Q=(V,A)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:A,isLoadingState:x,target:E.value})},G=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:E.value})},W=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:E.value})},D=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:E.value})},L=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:E.value})},z=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:E.value})},P=V=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:V,target:E.value})},q=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},K=t.ref(0),J=t.computed(()=>K.value&&s.value.length>0?Qg(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),Y=M.debounce(()=>{K.value=window.innerWidth},20);return t.onUnmounted(()=>{window.removeEventListener("resize",Y),Y.cancel()}),window.addEventListener("resize",Y),Y(),(V,A)=>{const ie=F.NCheckbox,ce=up,pe=F.NTooltip,at=lp,we=F.NTag,ke=op,kt=np,Ne=F.NButton,Jt=Jm,wn=Ql,Pt=Zl,ni=Gl,On=$s,cn=F.NDropdown,pt=F.NDataTable,se=F.NAlert,de=F.NSpin;return t.openBlock(),t.createBlock(Jl,{ref:"collapse-item-reference",name:n.categoryItem.id,"data-id":n.categoryItem.id,"onHeader:click":Q},{"pre-arrow":t.withCtx(()=>{var Re,qe;return[B.value?(t.openBlock(),t.createElementBlock("div",Y_,[t.createVNode(ie,{checked:w.value,indeterminate:C.value,disabled:T.value,"onUpdate:checked":U},null,8,["checked","indeterminate","disabled"])])):t.createCommentVNode("",!0),!d.value&&((Re=k.value)!=null&&Re.isDisabled)?(t.openBlock(),t.createBlock(pe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(ce,{class:"pt-1.5"})]),default:t.withCtx(()=>[A[1]||(A[1]=t.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):t.createCommentVNode("",!0),((qe=k.value)==null?void 0:qe.isFavorite)??!1?(t.openBlock(),t.createBlock(pe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(at,{class:"pt-1.5"})]),default:t.withCtx(()=>[A[2]||(A[2]=t.createTextVNode(" Избранная категория ",-1))]),_:1})):t.createCommentVNode("",!0)]}),header:t.withCtx(()=>{var Re,qe,dn,Kt,ii;return[t.createElementVNode("div",{class:t.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":n.categoryItem.isHidden,"text-gray-400":(Re=k.value)==null?void 0:Re.isDisabled})},[t.createVNode(pe,{disabled:!n.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(n.categoryItem.name),1)]),default:t.withCtx(()=>[A[3]||(A[3]=t.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),t.createElementVNode("div",{class:"w-fit",onClick:A[0]||(A[0]=t.withModifiers((...it)=>t.unref(M.noop)&&t.unref(M.noop)(...it),["prevent","stop"]))},[(qe=n.categoryItem.properties)!=null&&qe.m2Price?(t.openBlock(),t.createBlock(we,{key:0,size:t.unref(i),class:t.normalizeClass({"!pr-0":((dn=n.categoryItem.properties)==null?void 0:dn.templateCost)&&n.categoryItem.properties.m2PriceRetail&&R.value}),round:""},{default:t.withCtx(()=>{var it;return[t.createTextVNode(" Установленная стоимость: "+t.toDisplayString(n.categoryItem.properties.m2Price)+" руб./м2 ",1),(it=n.categoryItem.properties)!=null&&it.templateCost&&n.categoryItem.properties.m2PriceRetail&&R.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[R.value?(t.openBlock(),t.createBlock(we,{key:0,type:"success",bordered:!1,size:t.unref(i),class:"ml-2 !pr-0",round:""},{default:t.withCtx(()=>[R.value?(t.openBlock(),t.createElementBlock("span",U_,t.toDisplayString(R.value.toFixed(2))+"%",1)):t.createCommentVNode("",!0),t.createVNode(we,{size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createElementVNode("span",K_,t.toDisplayString(n.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(Kt=n.categoryItem.properties)!=null&&Kt.templateCost?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[I.value||R.value?(t.openBlock(),t.createBlock(we,{key:0,size:t.unref(i),round:""},{default:t.withCtx(()=>{var it;return[I.value?(t.openBlock(),t.createElementBlock("span",G_,t.toDisplayString((it=I.value)==null?void 0:it.name),1)):t.createCommentVNode("",!0),R.value?(t.openBlock(),t.createElementBlock("span",Z_,t.toDisplayString(R.value>0?"+":"")+t.toDisplayString(R.value.toFixed(2))+"%",1)):t.createCommentVNode("",!0)]}),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),a.value?(t.openBlock(),t.createBlock(we,{key:2,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Фиксированный курс: "+t.toDisplayString(a.value),1)]),_:1},8,["size"])):t.createCommentVNode("",!0),u.value&&((ii=k.value)!=null&&ii.manager)?(t.openBlock(),t.createBlock(we,{key:3,size:t.unref(i),closable:u.value!=="disabled",round:"",class:"align-bottom",onClose:L},{default:t.withCtx(()=>[t.createVNode(pe,{placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>{var it,en;return[t.createElementVNode("span",Q_,[t.createVNode(ke),t.createTextVNode(" "+t.toDisplayString((en=(it=k.value)==null?void 0:it.manager)==null?void 0:en.name),1)])]}),default:t.withCtx(()=>{var it,en;return[t.createTextVNode(' Категория закреплена за "'+t.toDisplayString((en=(it=k.value)==null?void 0:it.manager)==null?void 0:en.name)+'" ',1)]}),_:1})]),_:1},8,["size","closable"])):t.createCommentVNode("",!0)])]}),"sub-header":t.withCtx(()=>[n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",J_,[t.createElementVNode("ul",ew,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.categoryItem.id,slug:n.categoryItem.slug},(Re,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(Re),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.categoryItem.properties,(Re,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(Re),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)]),"header-extra":t.withCtx(()=>{var Re;return[t.createElementVNode("div",tw,[V.$slots["header-extra"]?(t.openBlock(),t.createElementBlock("div",nw,[t.renderSlot(V.$slots,"header-extra",{categoryItem:n.categoryItem},void 0,!0)])):t.createCommentVNode("",!0),d.value?(t.openBlock(),t.createBlock(pe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",iw,[t.createVNode(Ne,{ghost:!0,disabled:d.value==="disabled",size:t.unref(i),onClick:G},{default:t.withCtx(()=>{var qe;return[(qe=k.value)!=null&&qe.isDisabled?(t.openBlock(),t.createBlock(ce,{key:1})):(t.openBlock(),t.createBlock(kt,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(h.value),1)]),_:1})):t.createCommentVNode("",!0),u.value&&!((Re=k.value)!=null&&Re.manager)?(t.openBlock(),t.createBlock(pe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",rw,[t.createVNode(Ne,{ghost:!0,disabled:u.value==="disabled",size:t.unref(i),onClick:D},{default:t.withCtx(()=>[t.createVNode(Jt)]),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(p.value),1)]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(pe,{key:3,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",ow,[t.createVNode(Ne,{ghost:!0,disabled:f.value==="disabled",size:t.unref(i),onClick:W},{default:t.withCtx(()=>{var qe;return[(qe=k.value)!=null&&qe.isRequired?(t.openBlock(),t.createBlock(Pt,{key:1})):(t.openBlock(),t.createBlock(wn,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(m.value),1)]),_:1})):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createBlock(pe,{key:4,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(Ne,{ghost:!0,size:t.unref(i),type:"primary",onClick:z},{default:t.withCtx(()=>[t.createVNode(ni)]),_:1},8,["size"])]),default:t.withCtx(()=>[A[4]||(A[4]=t.createTextVNode(" Редактировать ",-1))]),_:1})):t.createCommentVNode("",!0),_.value.length>0?(t.openBlock(),t.createBlock(cn,{key:5,options:_.value,size:t.unref(i),trigger:"click",onSelect:P},{default:t.withCtx(()=>[t.createVNode(Ne,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(On)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])]}),default:t.withCtx(()=>[t.renderSlot(V.$slots,"default",{},()=>{var Re,qe,dn;return[t.createElementVNode("div",sw,[o.value?(t.openBlock(),t.createBlock(Ku,{key:0,"categories-items":n.categoryItem.categories??[],"has-products":c.value||x.value,"event-emitter":n.eventEmitter,"filtered-items":r.value?((Re=r.value)==null?void 0:Re.categories)??{}:void 0,"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[V.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:Kt})=>[t.renderSlot(V.$slots,"header-extra",{categoryItem:Kt},void 0,!0)]),key:"0"}:void 0]),1032,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-product-info-button","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):t.createCommentVNode("",!0)]),b.value&&y.value?(t.openBlock(),t.createBlock(qu,{key:0,"event-emitter":n.eventEmitter,settings:(qe=n.categoryItem.properties)==null?void 0:qe.configuratorSettings,editor:(dn=n.categoryItem.properties)==null?void 0:dn.configurator,category:n.categoryItem},null,8,["event-emitter","settings","editor","category"])):c.value?(t.openBlock(),t.createElementBlock("div",aw,[b.value?(t.openBlock(),t.createBlock(Ne,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:q},{default:t.withCtx(()=>[...A[5]||(A[5]=[t.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(pt,{columns:J.value,data:l.value,bordered:!0,loading:x.value,remote:!0,"row-key":Kt=>Kt.id,"table-layout":$.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):t.createCommentVNode("",!0),!x.value&&!v.value&&!o.value&&!c.value?(t.openBlock(),t.createBlock(se,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createBlock(se,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):t.createCommentVNode("",!0),x.value?(t.openBlock(),t.createBlock(de,{key:4,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...A[6]||(A[6]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),dw=fn(cw,[["__scopeId","data-v-a02c9f27"]]),uw={class:"sc-collapse flex w-full flex-col"},fw={},Uu=t.defineComponent({...fw,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(n,{emit:e}){const i=n,r=e,o=(s,a)=>{r("on-item-header-click",s,a)};return t.provide("itemHeaderClickHandler",o),t.provide("defaultExpandedNames",i.defaultExpandedNames),t.provide("expandedNames",i.expandedNames),(s,a)=>(t.openBlock(),t.createElementBlock("div",uw,[t.renderSlot(s.$slots,"default")]))}}),hw={},Ku=t.defineComponent({...hw,__name:"category-collapse",props:{categoriesItems:{},hasProducts:{type:Boolean},loading:{type:Boolean,default:!1},client:{default:void 0},filteredItems:{default:void 0},isCategoryItemSelected:{type:[Boolean,String,Function],default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function]},showCategoryRequiredButton:{type:[Boolean,String,Function]},showCategoryPinButton:{type:[Boolean,String,Function]},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function]},canShowConfigurator:{type:[Boolean,Function]},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(n){const e=n,i=t.inject(Br,"medium"),r=t.computed(()=>M.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(M.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(t.toRaw(l)),c};return(s,a)=>{const l=F.NSpin,c=F.NAlert;return t.openBlock(),t.createElementBlock(t.Fragment,null,[r.value.length>0?(t.openBlock(),t.createBlock(Uu,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,d=>(t.openBlock(),t.createBlock(dw,{key:d.id,"category-item":d,"event-emitter":n.eventEmitter,"filtered-items":o(d,n.filteredItems),"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[s.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:u})=>[t.renderSlot(s.$slots,"header-extra",{categoryItem:u})]),key:"0"}:void 0]),1032,["category-item","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-product-info-button","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"]))),128))]),_:3})):n.loading?(t.openBlock(),t.createBlock(l,{key:1,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...a[0]||(a[0]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0),!n.hasProducts&&!n.loading&&n.categoriesItems.length>0&&r.value.length===0?(t.openBlock(),t.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):t.createCommentVNode("",!0)],64)}}}),mw={},Gu=t.defineComponent({...mw,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!1},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0},disabledItem:{type:Function,default:void 0}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=new j.Reference,l=t.computed(()=>M.isNil(r.value)?s.value?[]:null:M.isArray(r.value)?r.value.filter(m=>!M.isNil(m)).map(m=>m.id):r.value.id),c=t.computed(()=>_t.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=m=>{var g;if(M.isArray(m)){const b=m.length>0?m.map(y=>{var _;return(_=c.value.find(k=>k.value===y))==null?void 0:_.item}).filter(y=>!M.isNil(y)):[];o("update:value",b)}else{const b=m===a.id||M.isNil(m)||(g=c.value.find(y=>y.value===m))==null?void 0:g.item;o("update:value",b)}},f=t.useTemplateRef("select-component");return e({focus:()=>{var m;return(m=f.value)==null?void 0:m.focus()},blur:()=>{var m;return(m=f.value)==null?void 0:m.blur()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(F.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled||c.value.length===0,filterable:n.filterable,"max-tag-count":n.maxTagCount,multiple:s.value,options:d.value,placeholder:"",class:"w-full","onUpdate:value":u},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),pw={},gw=t.defineComponent({...pw,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},disabledCoefficient:{type:Function},visibleCoefficient:{type:Function}},emits:["update:value"],setup(n,{emit:e}){var x,v;const i=n,r=e,o=()=>{const B=j.PriceCoefficient.getRetailPriceCoefficient();return M.unset(B,"isNewRec"),B},s=B=>!B||B.id===o().id,a=t.computed(()=>{var B;return((B=i.catalogItem)==null?void 0:B.type)==="product"}),l=t.computed(()=>a.value?i.catalogItem:void 0),c=B=>{var w,T,C,$;return B.id===o().id?(w=l.value)==null?void 0:w.getRetailCost():($=(C=(T=l.value)==null?void 0:T.priceCoefficients)==null?void 0:C.find(E=>E.coefficient.id===B.id))==null?void 0:$.cost},d=t.computed(()=>{var T;const w=[...((T=j.useReferencesStore().priceCoefficientsReference)==null?void 0:T.map(C=>structuredClone(t.toRaw(C))))??[],o()].filter(C=>{var $;return(($=i.visibleCoefficient)==null?void 0:$.call(i,C))??!0});return a.value&&w.forEach(C=>{var E;const $=c(C);$?C.name+=` (${$} ${(E=l.value)==null?void 0:E.currency.symbol})`:C.name=""}),w.filter(C=>C.name!=="")}),u=t.ref(i.value.coefficient),f=t.ref(((v=(x=i.value)==null?void 0:x.value)==null?void 0:v.toString())??null),h=t.ref(null),p=t.computed(()=>{var B,w;return(w=(B=l.value)==null?void 0:B.priceCoefficients)==null?void 0:w.find(T=>T.coefficient.slug===j.PriceCoefficientEnum.K0)}),m=t.ref(void 0),g=B=>Number.parseFloat((B??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),b=()=>{var w,T;m.value=void 0;let B=g(f.value);if(B=Number.isNaN(B)?void 0:B,a.value)if(u.value||f.value){const C=o(),$=c(u.value??C)??0,E=$+$*((B??0)/100);h.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(E),E>(((w=l.value)==null?void 0:w.getRetailCost())??E)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),p.value&&E<(((T=p.value)==null?void 0:T.cost)??0)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else h.value=null;r("update:value",{value:Number.isNaN(B)?void 0:B,coefficient:s(u.value)?void 0:structuredClone(t.toRaw(u.value))})},y=B=>{M.isArray(B)||M.isNull(B)||(u.value=B,f.value=null,!u.value&&f.value&&(u.value=o()),b())},_=()=>{u.value||(u.value=o()),b()},k=B=>{var T,C,$,E,I;const w=g(B);if(a.value){if(Number.isNaN(w)){u.value=void 0,f.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let R=0;if(w<=0)u.value=void 0,f.value=null;else if(p.value&&w<(((T=p.value)==null?void 0:T.cost)??0))u.value=(C=p.value)==null?void 0:C.coefficient,R=(w-p.value.cost)*100/p.value.cost,m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(w>((($=l.value)==null?void 0:$.getRetailCost())??w)){u.value=o();const O=((E=l.value)==null?void 0:E.getRetailCost())??0;R=(w-O)*100/O,m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const O=((I=l.value)==null?void 0:I.priceCoefficients)??[],U=M.sortBy(O,[W=>W.cost]),G=U.filter(W=>W.cost<=w).at(-1)??U.at(0);G&&(u.value=G.coefficient,R=(w-G.cost)*100/G.cost),m.value={validationStatus:void 0,feedback:void 0}}f.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(R),r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:s(u.value)?void 0:structuredClone(t.toRaw(u.value))})}else r("update:value",{value:Number.isNaN(w)?void 0:w,coefficient:void 0})};return t.onMounted(()=>{var B,w,T,C;i.calculationType===j.CalculationTypeEnum.m2Cost?h.value=((w=(B=i.value)==null?void 0:B.value)==null?void 0:w.toString())??null:!((T=i.value)!=null&&T.coefficient)&&((C=i.value)!=null&&C.value)&&(u.value=o()),b()}),(B,w)=>{var $,E,I;const T=F.NInput,C=F.NInputGroup;return t.openBlock(),t.createBlock(t.unref(F.NFormItem),{"show-label":!t.unref(M.isNil)(n.label),label:n.label,"show-feedback":!t.unref(M.isNil)((($=m.value)==null?void 0:$.feedback)??n.feedback),feedback:((E=m.value)==null?void 0:E.feedback)??n.feedback,"validation-status":((I=m.value)==null?void 0:I.validationStatus)??n.validationStatus},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass([{"sm:grid-cols-3":a.value&&n.calculationType!==t.unref(j.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[n.calculationType!==t.unref(j.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(C,{key:0,class:t.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:t.withCtx(()=>[t.createVNode(Gu,{class:"w-full min-w-0 flex-1",value:u.value,"reference-list":d.value,clearable:n.clearable,disabled:n.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"disabled-item":n.disabledCoefficient,"onUpdate:value":y},null,8,["value","reference-list","clearable","disabled","disabled-item"]),t.createVNode(T,{value:f.value,"onUpdate:value":[w[0]||(w[0]=R=>f.value=R),_],clearable:n.clearable,disabled:n.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},t.createSlots({suffix:t.withCtx(()=>[w[3]||(w[3]=t.createTextVNode("%",-1))]),_:2},[f.value&&!f.value.startsWith("-")?{name:"prefix",fn:t.withCtx(()=>[w[2]||(w[2]=t.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):t.createCommentVNode("",!0),a.value||n.calculationType===t.unref(j.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(T,{key:1,value:h.value,"onUpdate:value":[w[1]||(w[1]=R=>h.value=R),k],clearable:n.clearable,disabled:n.disabled,placeholder:"Стоимость",class:"w-full"},t.createSlots({_:2},[a.value?{name:"suffix",fn:t.withCtx(()=>{var R;return[t.createTextVNode(t.toDisplayString((R=l.value)==null?void 0:R.currency.symbol),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):t.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),yw={class:"text-sm"},bw={class:"text-sm"},_w={},ww=t.defineComponent({..._w,__name:"add-product-to-cart-dialog",emits:["submit"],setup(n,{expose:e,emit:i}){const r=t.useTemplateRef("form-reference"),o=t.useTemplateRef("base-dialog-reference"),s=t.ref(!1),a=t.ref(null),l=t.computed(()=>{var R,O,U;return((R=a.value)==null?void 0:R.unit.isLinear)&&((U=(O=a.value)==null?void 0:O.properties)==null?void 0:U.isLengthConfigurator)}),c=t.computed(()=>a.value?j.UnitsHelper.productIsMeasurable(a.value)||l.value?"шт.":a.value.unit.name:"шт."),d=t.ref(void 0),u=t.ref(void 0),f=t.ref(!0),h=t.ref(null),p=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.quantity)??null},set:R=>{h.value&&(h.value.quantity=R??0)}}),m=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.length)??null},set:R=>{h.value&&(h.value.length=R??void 0)}}),g=R=>{h.value&&(h.value.marker=R??void 0)},b=i,y=()=>({length:{},quantity:{},marker:{}}),_=t.ref(y()),k=t.ref(!1),x=t.computed(()=>{var G,W,D,L;if(!a.value)return{};const R=j.UnitsHelper.getProductLengthMultiplicity(a.value),O=j.UnitsHelper.getProductMultiplicity(a.value),U=((W=(G=a.value)==null?void 0:G.properties)==null?void 0:W.minLength)||R,Q=(L=(D=a.value)==null?void 0:D.properties)==null?void 0:L.maxLength;return{length:[le.required,le.min(U??.1),le.max(Q),le.step(R),He.serverValidation(_.value.length.feedback)],quantity:[le.required,le.min(O),le.step(O),He.serverValidation(_.value.quantity.feedback)],marker:[He.serverValidation(_.value.marker.feedback)]}}),v=t.computed(()=>{var R,O,U;return a.value?((R=a.value.properties)==null?void 0:R.lengthStep)??((O=a.value.properties)!=null&&O.ignoreMinCountCheck?0:((U=a.value.properties)==null?void 0:U.minCount)??0):0}),B=t.computed(()=>{var U,Q,G,W,D,L,z,P,q;if(!a.value)return"";const R=((Q=(U=a.value)==null?void 0:U.properties)==null?void 0:Q.minLength)??((W=(G=a.value)==null?void 0:G.properties)!=null&&W.ignoreMinCountCheck?0:(L=(D=a.value)==null?void 0:D.properties)==null?void 0:L.minCount),O=(P=(z=a.value)==null?void 0:z.properties)==null?void 0:P.maxLength;return R||O?`(${R?`от ${R}`:""}${R&&O?" ":""}${O?`до ${O}`:""} ${(q=a.value)==null?void 0:q.unit.name})`:""}),w=R=>{var W,D;if(!((D=(W=a.value)==null?void 0:W.properties)!=null&&D.isLengthConfigurator)||!h.value||M.isNil(R)||v.value===0)return;const O=R/v.value,U=Math.round(O),Q=j.UnitsHelper.getProductMultiplicity(a.value),G=Math.max(U,Q);h.value.quantity=G},T=R=>{var G,W,D,L;if(!((W=(G=a.value)==null?void 0:G.properties)!=null&&W.isLengthConfigurator)||!h.value||M.isNil(R)||v.value===0)return;const O=R*v.value,U=((D=a.value.properties)==null?void 0:D.minLength)||j.UnitsHelper.getProductLengthMultiplicity(a.value),Q=(L=a.value.properties)==null?void 0:L.maxLength;U!==void 0&&O<U?h.value.length=U:Q!==void 0&&O>Q?h.value.length=Q:h.value.length=O},C=async R=>{var U;const O=M.cloneDeep(h.value);try{await((U=r.value)==null?void 0:U.validate(Q=>{if(!Q){if(!a.value||!O)return;j.UnitsHelper.productIsMeasurable(a.value)||delete O.length,l.value&&v.value&&(O.length=v.value),k.value=!0,b("submit",O,_.value,()=>{k.value=!1,R(!1),t.nextTick(()=>{var G;(G=r.value)==null||G.validate(M.noop).catch(M.noop)})})}}))}catch{}},$=()=>{a.value=null,d.value=void 0,h.value=null,_.value=y()},E=()=>{s.value=!1};return e({show:(R,O)=>{var U,Q,G,W,D;if($(),s.value=!0,a.value=R,d.value=O==null?void 0:O.cartItemData,u.value=O==null?void 0:O.orderId,f.value=(O==null?void 0:O.canSetDopProdaga)??!1,h.value=new j.OrderItemBase((O==null?void 0:O.cartItemData)??new j.OrderItemBase({product:R,quantity:j.UnitsHelper.productIsMeasurable(a.value)?1:((U=R==null?void 0:R.properties)==null?void 0:U.minCount)??1,length:((Q=R==null?void 0:R.properties)==null?void 0:Q.minLength)||((G=R==null?void 0:R.properties)!=null&&G.ignoreMinCountCheck?0:(W=R==null?void 0:R.properties)==null?void 0:W.minCount)||0})),(D=R==null?void 0:R.properties)!=null&&D.isLengthConfigurator&&h.value&&v.value>0){const L=v.value,z=h.value.quantity||1;h.value.length=z*L}},closeDialog:E}),(R,O)=>{var D;const U=F.NFormItem,Q=F.NInputGroupLabel,G=F.NInputGroup,W=F.NCheckbox;return t.openBlock(),t.createBlock(Ps,{ref:"base-dialog-reference",show:s.value,title:`${d.value?"Изменение":"Добавление"} товара ${(D=a.value)==null?void 0:D.name} в ${u.value?` заказ №${u.value}`:"корзину"}`,"accept-button":{show:!0,text:d.value?"Изменить":"Добавить"},processing:k.value,"modal-width":500,onAccept:C,onClosing:E},{default:t.withCtx(()=>[a.value&&h.value?t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{key:0,ref:"form-reference",model:h.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.unref(j.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(U,{key:0,path:"length",label:`Метраж, ${B.value+a.value.unit.name}`},t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:m.value,"onUpdate:value":[O[0]||(O[0]=L=>m.value=L),w],parse:t.unref(ct),step:t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:O[1]||(O[1]=L=>t.unref(ao)(L,".",!1)),onInput:O[2]||(O[2]=L=>t.unref(ot)(_.value,"length")),onFocus:t.unref(Le)},null,8,["value","parse","step","onFocus"])]),_:2},[!_.value.length.feedback&&t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",yw,"Метраж должно быть кратно "+t.toDisplayString(t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):t.createCommentVNode("",!0),t.createVNode(U,{path:"quantity",label:`Количество, ${c.value}`},{default:t.withCtx(()=>[t.createVNode(G,null,t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:p.value,"onUpdate:value":[O[3]||(O[3]=L=>p.value=L),T],parse:t.unref(ct),step:t.unref(j.UnitsHelper).getProductMultiplicity(a.value),"show-button":t.unref(j.UnitsHelper).getProductMultiplicity(a.value)>1,"button-placement":"both",placeholder:"Введите количество",class:"w-full",onKeydown:O[4]||(O[4]=L=>t.unref(ao)(L,".",!1)),onInput:O[5]||(O[5]=L=>t.unref(ot)(_.value,"quantity")),onFocus:t.unref(Le)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(t.openBlock(),t.createBlock(Q,{key:0,class:"bg-orange-100 font-bold"},{default:t.withCtx(()=>[t.createTextVNode(" x "+t.toDisplayString(v.value)+" "+t.toDisplayString(a.value.unit.name),1)]),_:1})):t.createCommentVNode("",!0)]),_:2},[!_.value.quantity.feedback&&t.unref(j.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",bw,"Количество должно быть кратно "+t.toDisplayString(t.unref(j.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1},8,["label"]),t.unref(j.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(U,{key:1,path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:h.value.marker??null,placeholder:"Введите маркировку",onInput:O[6]||(O[6]=L=>t.unref(ot)(_.value,"marker")),"onUpdate:value":O[7]||(O[7]=L=>g(L)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(W,{key:2,checked:h.value.isAdditionalSale,"onUpdate:checked":O[8]||(O[8]=L=>h.value.isAdditionalSale=L),"true-value":!0,"false-value":!1},{default:t.withCtx(()=>[...O[9]||(O[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[t.unref(oi),()=>{var L,z;return(z=(L=o.value)==null?void 0:L.acceptHandler)==null?void 0:z.call(L)}]]):t.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),xw={class:"flex flex-row gap-1"},kw={class:"sc-client-name flex flex-col gap-1 text-base"},Cw=["href"],vw={key:1,class:"text-sc-grey"},Sw={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Bw={key:0},Nw={key:1,class:"text-sm"},Tw={},Ir=t.defineComponent({...Tw,__name:"client-name-with-short-info",props:{client:{},nameLink:{default:void 0},popoverPosition:{default:void 0},showCityAndRegion:{type:Boolean,default:!0},showSalesDirection:{type:Boolean,default:!1},showClientInfoIcon:{type:Boolean,default:!1}},emits:["click:client-name","click:client-info"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>i.client.lastLoginAt?xe.format(i.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{M.isNil(i.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",i.client,a)};return(a,l)=>{const c=lo,d=F.NButton,u=F.NPopover;return t.openBlock(),t.createElementBlock("div",xw,[n.showClientInfoIcon?(t.openBlock(),t.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=f=>a.$emit("click:client-info",n.client))},{default:t.withCtx(()=>[t.createVNode(c)]),_:1})):t.createCommentVNode("",!0),t.createVNode(u,{disabled:t.unref(M.isNil)(n.popoverPosition),placement:n.popoverPosition},{trigger:t.withCtx(()=>[t.createElementVNode("div",kw,[t.createElementVNode("a",{href:n.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=f=>s(f))},[t.createElementVNode("span",{class:t.normalizeClass({"line-through":!n.client.isActive})},t.toDisplayString(n.client.name),3),n.showSalesDirection&&n.client.salesDirection?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"line-through":!n.client.isActive})}," ("+t.toDisplayString(n.client.salesDirection.name)+") ",3)):t.createCommentVNode("",!0),n.client.isActive?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",vw," [ Деактивирован ] "))],8,Cw),n.showCityAndRegion&&n.client.city?(t.openBlock(),t.createElementBlock("span",Sw," г. "+t.toDisplayString(n.client.city.name)+", "+t.toDisplayString(n.client.city.region.name),1)):t.createCommentVNode("",!0)])]),default:t.withCtx(()=>[n.client.alternativeName?(t.openBlock(),t.createElementBlock("div",Bw,t.toDisplayString(n.client.alternativeName),1)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("span",Nw," Последний вход: "+t.toDisplayString(o.value),1)):t.createCommentVNode("",!0),t.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),$w={class:"text-base"},Ew={},Zu=t.defineComponent({...Ew,__name:"contragent-with-short-info",props:{contragent:{}},setup(n){const e=n,i=t.computed(()=>si.getFormatEntityName(e.contragent));return(r,o)=>(t.openBlock(),t.createElementBlock("span",$w,t.toDisplayString(i.value),1))}}),Rw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Pw(n,e){return t.openBlock(),t.createElementBlock("svg",Rw,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)])])}const Fw=t.markRaw({name:"tabler-mail",render:Pw}),Vw=["href"],Mw={},Iw=t.defineComponent({...Mw,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(n){return(e,i)=>{const r=Fw;return t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showEmailIcon})},[n.showEmailIcon?(t.openBlock(),t.createBlock(r,{key:0})):t.createCommentVNode("",!0),t.createElementVNode("a",{href:`mailto:${n.email}`,class:"no-underline"},t.toDisplayString(n.email),9,Vw)],2)}}}),Aw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Ow(n,e){return t.openBlock(),t.createElementBlock("svg",Aw,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M444 49.9C431.3 38.2 379.9.9 265.3.4c0 0-135.1-8.1-200.9 52.3C27.8 89.3 14.9 143 13.5 209.5s-3.1 191.1 117 224.9h.1l-.1 51.6s-.8 20.9 13 25.1c16.6 5.2 26.4-10.7 42.3-27.8c8.7-9.4 20.7-23.2 29.8-33.7c82.2 6.9 145.3-8.9 152.5-11.2c16.6-5.4 110.5-17.4 125.7-142c15.8-128.6-7.6-209.8-49.8-246.5M457.9 287c-12.9 104-89 110.6-103 115.1c-6 1.9-61.5 15.7-131.2 11.2c0 0-52 62.7-68.2 79c-5.3 5.3-11.1 4.8-11-5.7c0-6.9.4-85.7.4-85.7q-.15 0 0 0C43.1 372.7 49.1 266.6 50.2 211.1s11.6-101 42.6-131.6c55.7-50.5 170.4-43 170.4-43c96.9.4 143.3 29.6 154.1 39.4c35.7 30.6 53.9 103.8 40.6 211.1m-139-80.8c.4 8.6-12.5 9.2-12.9.6c-1.1-22-11.4-32.7-32.6-33.9c-8.6-.5-7.8-13.4.7-12.9c27.9 1.5 43.4 17.5 44.8 46.2m20.3 11.3c1-42.4-25.5-75.6-75.8-79.3c-8.5-.6-7.6-13.5.9-12.9c58 4.2 88.9 44.1 87.8 92.5c-.1 8.6-13.1 8.2-12.9-.3m47 13.4c.1 8.6-12.9 8.7-12.9.1c-.6-81.5-54.9-125.9-120.8-126.4c-8.5-.1-8.5-12.9 0-12.9c73.7.5 133 51.4 133.7 139.2M374.9 329v.2c-10.8 19-31 40-51.8 33.3l-.2-.3c-21.1-5.9-70.8-31.5-102.2-56.5c-16.2-12.8-31-27.9-42.4-42.4c-10.3-12.9-20.7-28.2-30.8-46.6c-21.3-38.5-26-55.7-26-55.7c-6.7-20.8 14.2-41 33.3-51.8h.2c9.2-4.8 18-3.2 23.9 3.9c0 0 12.4 14.8 17.7 22.1c5 6.8 11.7 17.7 15.2 23.8c6.1 10.9 2.3 22-3.7 26.6l-12 9.6c-6.1 4.9-5.3 14-5.3 14s17.8 67.3 84.3 84.3c0 0 9.1.8 14-5.3l9.6-12c4.6-6 15.7-9.8 26.6-3.7c14.7 8.3 33.4 21.2 45.8 32.9c7 5.7 8.6 14.4 3.8 23.6"},null,-1)])])}const Qu=t.markRaw({name:"fa6-brands-viber",render:Ow}),zw={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Dw=["id"],Lw=["id"],Hw=["fill"],Ww=["fill"];function jw(n,e){return t.openBlock(),t.createElementBlock("svg",zw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGBRLHCcSy,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)])],8,Dw),t.createElementVNode("linearGradient",{id:n.idMap.SVGHW6lecxh,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[1]||(e[1]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)])],8,Lw)]),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGBRLHCcSy+")",d:"M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004"},null,8,Hw),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGHW6lecxh+")",d:"M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z"},null,8,Ww),e[2]||(e[2]=t.createElementVNode("path",{fill:"#FFF",d:"M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"},null,-1))])}const Ju=t.markRaw({name:"logos-whatsapp-icon",render:jw,setup(){const n=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+n(),SVGHW6lecxh:"uicons-"+n()}}}}),qw={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},Xw=["id"],Yw=["fill"];function Uw(n,e){return t.openBlock(),t.createElementBlock("svg",qw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGuySfwdaH,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)])],8,Xw)]),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGuySfwdaH+")",d:"M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"},null,8,Yw),e[1]||(e[1]=t.createElementVNode("path",{fill:"#FFF",d:"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"},null,-1))])}const ef=t.markRaw({name:"logos-telegram",render:Uw,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),Kw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Gw(n,e){return t.openBlock(),t.createElementBlock("svg",Kw,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M391 480c-19.52 0-46.94-7.06-88-30c-49.93-28-88.55-53.85-138.21-103.38C116.91 298.77 93.61 267.79 61 208.45c-36.84-67-30.56-102.12-23.54-117.13C45.82 73.38 58.16 62.65 74.11 52a176.3 176.3 0 0 1 28.64-15.2c1-.43 1.93-.84 2.76-1.21c4.95-2.23 12.45-5.6 21.95-2c6.34 2.38 12 7.25 20.86 16c18.17 17.92 43 57.83 52.16 77.43c6.15 13.21 10.22 21.93 10.23 31.71c0 11.45-5.76 20.28-12.75 29.81c-1.31 1.79-2.61 3.5-3.87 5.16c-7.61 10-9.28 12.89-8.18 18.05c2.23 10.37 18.86 41.24 46.19 68.51s57.31 42.85 67.72 45.07c5.38 1.15 8.33-.59 18.65-8.47c1.48-1.13 3-2.3 4.59-3.47c10.66-7.93 19.08-13.54 30.26-13.54h.06c9.73 0 18.06 4.22 31.86 11.18c18 9.08 59.11 33.59 77.14 51.78c8.77 8.84 13.66 14.48 16.05 20.81c3.6 9.53.21 17-2 22c-.37.83-.78 1.74-1.21 2.75a176.5 176.5 0 0 1-15.29 28.58c-10.63 15.9-21.4 28.21-39.38 36.58A67.4 67.4 0 0 1 391 480"},null,-1)])])}const tf=t.markRaw({name:"ion-call",render:Gw}),Zw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Qw(n,e){return t.openBlock(),t.createElementBlock("svg",Zw,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2m10 3a2 2 0 0 1 2 2m-2-6a6 6 0 0 1 6 6"},null,-1)])])}const Jw=t.markRaw({name:"tabler-phone-call",render:Qw}),ex={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},tx=["href"],nx=["href"],ix=["href"],rx=["href"],ox={},sx=t.defineComponent({...ox,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{try{return e.phone?xr.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=t.computed(()=>{var l;return M.isString(i.value)?!1:((l=i.value)==null?void 0:l.isValid())??!1}),o=t.computed(()=>{var l;return M.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=t.computed(()=>{var l;return M.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("E.164"))??""}),a=t.ref(!1);return(l,c)=>{const d=Jw,u=tf,f=ef,h=Ju,p=Qu;return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",{class:t.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=m=>a.value=!a.value),onFocusout:c[1]||(c[1]=m=>a.value=!1),onMouseleave:c[2]||(c[2]=m=>a.value=!1)},[t.createElementVNode("div",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showPhoneIcon})},[n.showPhoneIcon?(t.openBlock(),t.createBlock(d,{key:0})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)],2),r.value&&a.value?(t.openBlock(),t.createElementBlock("div",ex,[r.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${s.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[t.createVNode(u)],8,tx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${s.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(f)],8,nx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(h)],8,ix)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[t.createVNode(p)],8,rx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],34)])}}}),ax={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lx(n,e){return t.openBlock(),t.createElementBlock("svg",ax,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)])])}const cx=t.markRaw({name:"mdi-envelope",render:lx}),dx={class:"flex flex-col gap-1"},ux={key:0,class:"mb-2 flex flex-col text-base"},fx={key:0,class:"text-sc-dark-grey text-sm"},hx={key:1,class:"whitespace-nowrap text-sm"},mx={key:2,class:"whitespace-nowrap text-sm"},px={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},gx=["href"],yx=["href"],bx=["href"],_x=["href"],wx=["href"],xx={key:0,class:"flex flex-col text-base"},kx={key:0,class:"text-sc-dark-grey text-sm"},Cx={key:1,class:"mt-2 text-sm"},vx={key:0,class:"-mt-1"},Sx={},Bx=t.defineComponent({...Sx,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(n){const e=n,i=t.computed(()=>si.getFormatEntityName(e.contact)),r=t.computed(()=>{try{return e.contact.phone?xr.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=t.computed(()=>{var d;return M.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=t.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=t.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("E.164"))??""}),l=t.computed(()=>o.value||e.contact.email),c=t.ref(!1);return(d,u)=>{var y,_;const f=tf,h=ef,p=Ju,m=Qu,g=cx,b=F.NPopover;return t.openBlock(),t.createElementBlock("div",dx,[t.createVNode(b,{disabled:n.fullView,placement:"bottom"},{trigger:t.withCtx(()=>{var k,x,v,B;return[t.createElementVNode("div",{class:t.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(k=n.contact)!=null&&k.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${n.classes}`),style:t.normalizeStyle(n.styles),onMouseenter:u[0]||(u[0]=w=>c.value=!0),onFocusin:u[1]||(u[1]=w=>c.value=!0),onMouseleave:u[2]||(u[2]=w=>c.value=!1),onFocusout:u[3]||(u[3]=w=>c.value=!1)},[t.createElementVNode("div",null,[n.fullView&&(n.contact.name||(x=n.contact)!=null&&x.position)?(t.openBlock(),t.createElementBlock("div",ux,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(v=n.contact)!=null&&v.position?(t.openBlock(),t.createElementBlock("span",fx,t.toDisplayString((B=n.contact)==null?void 0:B.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),n.contact.phone?(t.openBlock(),t.createElementBlock("div",hx,t.toDisplayString(s.value),1)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("div",mx,t.toDisplayString(n.contact.email),1)):t.createCommentVNode("",!0),l.value&&c.value?(t.openBlock(),t.createElementBlock("div",px,[o.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${a.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[t.createVNode(f)],8,gx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${a.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(h)],8,yx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(p)],8,bx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${a.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[t.createVNode(m)],8,_x)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("a",{key:4,href:`mailto:${n.contact.email}`,class:"hover:text-3xl"},[t.createVNode(g)],8,wx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])],38)]}),default:t.withCtx(()=>{var k,x,v,B;return[n.contact.name?(t.openBlock(),t.createElementBlock("div",xx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(k=n.contact)!=null&&k.position?(t.openBlock(),t.createElementBlock("span",kx,t.toDisplayString((x=n.contact)==null?void 0:x.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),(v=n.contact)!=null&&v.comment?(t.openBlock(),t.createElementBlock("div",Cx,[u[4]||(u[4]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((B=n.contact)==null?void 0:B.comment),1)])):t.createCommentVNode("",!0)]}),_:1},8,["disabled"]),n.fullView&&((y=n.contact)!=null&&y.comment)?(t.openBlock(),t.createElementBlock("div",vx,[u[5]||(u[5]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((_=n.contact)==null?void 0:_.comment),1)])):t.createCommentVNode("",!0)])}}});class Nx{constructor(e){N(this,"minHeight");N(this,"maxHeights");N(this,"minWidth");N(this,"maxWidths");N(this,"netType");N(this,"color");N(this,"mountType");N(this,"descriptions");N(this,"crossbarCount");N(this,"heightOverlaps");N(this,"widthOverlaps");N(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=xs.objectToSnake(e.descriptions),this.maxHeights=e.maxHeights,this.maxWidths=e.maxWidths,this.minHeight=e.minHeight,this.minWidth=e.minWidth,this.mountType=e.mountType,this.netType=e.netType,this.heightOverlaps=xs.objectToSnake(e.heightOverlaps),this.widthOverlaps=xs.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function Tx(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:n.properties.configuratorSettings!==void 0&&M.isArray(n.products)&&n.products.length>0}const $x={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ex(n,e){return t.openBlock(),t.createElementBlock("svg",$x,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M16 12a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2"},null,-1)])])}const Rx=t.markRaw({name:"mdi-dots-horizontal",render:Ex}),Px={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fx(n,e){return t.openBlock(),t.createElementBlock("svg",Px,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5A6.5 6.5 0 0 0 9.5 3A6.5 6.5 0 0 0 3 9.5A6.5 6.5 0 0 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5l1.5-1.5zm-6 0C7 14 5 12 5 9.5S7 5 9.5 5S14 7 14 9.5S12 14 9.5 14M7 9h5v1H7z"},null,-1)])])}const Vx=t.markRaw({name:"mdi-magnify-minus-outline",render:Fx}),Mx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ix(n,e){return t.openBlock(),t.createElementBlock("svg",Mx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m15.5 14l5 5l-1.5 1.5l-5-5v-.79l-.27-.28A6.47 6.47 0 0 1 9.5 16A6.5 6.5 0 0 1 3 9.5A6.5 6.5 0 0 1 9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27zm-6 0C12 14 14 12 14 9.5S12 5 9.5 5S5 7 5 9.5S7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2z"},null,-1)])])}const Ax=t.markRaw({name:"mdi-magnify-plus-outline",render:Ix}),Ox={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zx(n,e){return t.openBlock(),t.createElementBlock("svg",Ox,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z"},null,-1)])])}const nf=t.markRaw({name:"mdi-chevron-right",render:zx}),Dx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Lx(n,e){return t.openBlock(),t.createElementBlock("svg",Dx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z"},null,-1)])])}const rf=t.markRaw({name:"mdi-chevron-left",render:Lx}),Hx={heightMedium:"40px",paddingMedium:"0 16px",borderRadiusMedium:"10px",fontSizeMedium:"14px",iconSizeMedium:"18px",iconMarginMedium:"8px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},Ar={heightSmall:"36px",paddingSmall:"0 10px",borderRadiusSmall:"8px",iconSizeSmall:"18px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},of="date-range.dialog.mode",sf="date-range.dialog.scale",af="date-range.quick-periods",lf=["thisMonth","lastMonth","thisQuarter","lastQuarter","thisYear","lastYear","fromBeginningOfThisYear"],cf=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Wx=["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],jx=["Пн","Вт","Ср","Чт","Пт","Сб","Вс"],df=new Date(2e3,0,1),Ti=n=>xe.differenceInCalendarDays(n,df),uf=n=>xe.addDays(df,n),ff=(n,e,i)=>{let r=n??void 0,o=e??void 0;return r&&o&&r>o&&(i!=null&&i.from?o=r:i!=null&&i.to?r=o:[r,o]=[o,r]),{from:r?xe.startOfDay(r):void 0,to:o?xe.endOfDay(o):void 0}},Ra=n=>Object.entries(n).map(([e,i])=>({value:e,label:i.label,item:i})),hf=(n,e)=>{const i=Object.entries(n).filter(([,r])=>r.group===e);return e!=="other"?[{type:"group",key:e,children:Ra(Object.fromEntries(i))}]:j.STANDARD_PERIOD_SECTIONS.map(r=>{const o=i.filter(([,s])=>s.section===r.key);return{type:"group",key:r.key,label:r.label,children:Ra(Object.fromEntries(o))}}).filter(r=>r.children.length>0)},mf=(n,e)=>{const i=t.ref(null),r=t.ref(null),o=t.ref(!1),s=t.ref(null),a=(g,b)=>g<=b?[g,b]:[b,g],l=t.computed(()=>o.value&&r.value!==null&&s.value!==null?a(r.value,s.value):i.value!==null?s.value===null?[i.value,i.value]:a(i.value,s.value):n.value),c=(g,b)=>{i.value=null,e(...a(g,b))},d=g=>{i.value===null?(i.value=g,e(g,g)):c(i.value,g)},u=()=>{globalThis.removeEventListener("pointerup",u);const g=r.value;if(g!==null){if(r.value=null,o.value){o.value=!1,s.value!==null&&c(g,s.value);return}d(g)}},f=g=>{r.value=g,o.value=!1,globalThis.addEventListener("pointerup",u)},h=g=>{s.value=g,r.value!==null&&g!==r.value&&(o.value=!0)},p=()=>{s.value=null},m=g=>{const b=l.value;return!b||g<b[0]||g>b[1]?null:g===b[0]||g===b[1]?"bound":"in-range"};return t.onBeforeUnmount(()=>{globalThis.removeEventListener("pointerup",u)}),{activeRange:l,cellPosition:m,pointerDownHandler:f,pointerEnterHandler:h,pointerLeaveHandler:p,selectHandler:d}},qx={class:"flex items-center justify-between gap-2"},Xx={class:"flex items-center gap-2"},Yx={class:"text-center font-semibold"},Ux={class:"grid grid-cols-7 gap-0.5 text-center text-xs text-gray-500"},Kx={class:"grid grid-cols-7 gap-0.5"},Gx=["disabled","onPointerdown","onPointerenter","onKeydown"],Zx={},Qx=t.defineComponent({...Zx,__name:"day-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=42,s=F.useThemeVars(),a=t.computed(()=>({"--sc-primary-color":s.value.primaryColor,"--sc-primary-color-hover":s.value.primaryColorHover,"--sc-primary-color-suppl":s.value.primaryColorSuppl,"--sc-hover-color":s.value.hoverColor})),l=Xe.initRefDependingOnDeviceResolution(1,2,3),c=t.computed(()=>["grid-cols-1","grid-cols-2","grid-cols-3"][l.value-1]),d=y=>xe.subMonths(xe.startOfMonth(y),l.value===3?1:0),u=y=>y&&xe.isValid(y)?y:new Date,f=t.ref(d(u(i.from??i.to))),h=t.computed(()=>{const{from:y,to:_}=i;return!y||!_||!xe.isValid(y)||!xe.isValid(_)?null:[Ti(y),Ti(_)]}),p=mf(h,(y,_)=>{r("select",{from:xe.startOfDay(uf(y)),to:xe.endOfDay(uf(_))})}),m=y=>{const _=xe.subDays(y,(xe.getDay(y)+6)%7);return M.times(o,k=>{const x=xe.addDays(_,k);return{index:Ti(x),day:x.getDate(),isCurrentMonth:xe.isSameMonth(x,y),isToday:xe.isToday(x)}})},g=t.computed(()=>M.times(l.value,y=>{const _=xe.addMonths(f.value,y);return{key:`${_.getFullYear()}-${_.getMonth()}`,title:`${Wx[_.getMonth()]} ${_.getFullYear()}`,cells:m(_)}})),b=y=>{if(!y.isCurrentMonth)return["sc-day--outside"];const _=y.isToday?["sc-day--today"]:[],k=p.cellPosition(y.index);return k&&_.push(`sc-day--${k}`),_};return t.watch(()=>[i.from,i.to],()=>{const y=i.from??i.to;if(!y||!xe.isValid(y))return;const _=`${y.getFullYear()}-${y.getMonth()}`;M.some(g.value,["key",_])||(f.value=d(y))}),(y,_)=>{const k=rf,x=F.NButton,v=nf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(a.value),onPointerleave:_[2]||(_[2]=(...B)=>t.unref(p).pointerLeaveHandler&&t.unref(p).pointerLeaveHandler(...B))},[t.createElementVNode("div",qx,[t.createVNode(x,{size:"small","aria-label":"Предыдущий месяц","theme-overrides":t.unref(Ar),onClick:_[0]||(_[0]=B=>f.value=t.unref(xe.subMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(k)]),_:1},8,["theme-overrides"]),_[3]||(_[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон на календаре",-1)),t.createElementVNode("div",Xx,[t.renderSlot(y.$slots,"actions",{},void 0,!0),t.createVNode(x,{size:"small","aria-label":"Следующий месяц","theme-overrides":t.unref(Ar),onClick:_[1]||(_[1]=B=>f.value=t.unref(xe.addMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(v)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-3",c.value])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,B=>(t.openBlock(),t.createElementBlock("div",{key:B.key,class:"flex flex-col gap-1"},[t.createElementVNode("div",Yx,t.toDisplayString(B.title),1),t.createElementVNode("div",Ux,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(jx),w=>(t.openBlock(),t.createElementBlock("span",{key:w},t.toDisplayString(w),1))),128))]),t.createElementVNode("div",Kx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.cells,w=>(t.openBlock(),t.createElementBlock("button",{key:w.index,type:"button",class:t.normalizeClass(["sc-day h-7 rounded border-0 p-0 text-xs",b(w)]),disabled:!w.isCurrentMonth,onPointerdown:t.withModifiers(T=>t.unref(p).pointerDownHandler(w.index),["prevent"]),onPointerenter:T=>t.unref(p).pointerEnterHandler(w.index),onKeydown:[t.withKeys(t.withModifiers(T=>t.unref(p).selectHandler(w.index),["prevent"]),["enter"]),t.withKeys(t.withModifiers(T=>t.unref(p).selectHandler(w.index),["prevent"]),["space"])]},t.toDisplayString(w.day),43,Gx))),128))])]))),128))],2),_[4]||(_[4]=t.createStaticVNode('<div class="flex flex-wrap items-center gap-x-6 gap-y-1 text-xs text-gray-700" data-v-a41e813d><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата начала</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--in-range" data-v-a41e813d></i>Выбранный период</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата окончания</span></div>',1))],36)}}}),Jx=fn(Qx,[["__scopeId","data-v-a41e813d"]]),ek={class:"flex items-center justify-between gap-2"},tk={class:"flex items-center gap-2"},nk={class:"text-center font-semibold"},ik={class:"grid grid-cols-3 gap-2"},rk=["onPointerdown","onPointerenter","onKeydown"],ok={},sk=t.defineComponent({...ok,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=F.useThemeVars(),s=t.computed(()=>({"--sc-primary-color":o.value.primaryColor,"--sc-primary-color-hover":o.value.primaryColorHover,"--sc-primary-color-suppl":o.value.primaryColorSuppl,"--sc-hover-color":o.value.hoverColor})),a=p=>{const m=new Date().getFullYear();return p&&xe.isValid(p)?p.getFullYear():m},l=t.ref(a(i.from??i.to)),c=Xe.initRefDependingOnDeviceResolution(1,3,3),d=t.computed(()=>c.value===1?[l.value]:[l.value-1,l.value,l.value+1]),u=t.computed(()=>{const{from:p,to:m}=i;return!p||!m||!xe.isValid(p)||!xe.isValid(m)?null:[p.getFullYear()*12+p.getMonth(),m.getFullYear()*12+m.getMonth()]}),f=mf(u,(p,m)=>{r("select",{from:new Date(Math.floor(p/12),p%12,1),to:xe.endOfMonth(new Date(Math.floor(m/12),m%12,1))})}),h=(p,m)=>{const g=f.cellPosition(p*12+m);return g?[`sc-month--${g}`]:[]};return t.watch(()=>[i.from,i.to],()=>{const p=i.from??i.to;if(!p||!xe.isValid(p))return;const m=p.getFullYear();(m<l.value-1||m>l.value+1)&&(l.value=m)}),(p,m)=>{const g=rf,b=F.NButton,y=nf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(s.value),onPointerleave:m[2]||(m[2]=(..._)=>t.unref(f).pointerLeaveHandler&&t.unref(f).pointerLeaveHandler(..._))},[t.createElementVNode("div",ek,[t.createVNode(b,{size:"small","aria-label":"Предыдущий год","theme-overrides":t.unref(Ar),onClick:m[0]||(m[0]=_=>l.value-=1)},{icon:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["theme-overrides"]),m[3]||(m[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон месяцев",-1)),t.createElementVNode("div",tk,[t.renderSlot(p.$slots,"actions",{},void 0,!0),t.createVNode(b,{size:"small","aria-label":"Следующий год","theme-overrides":t.unref(Ar),onClick:m[1]||(m[1]=_=>l.value+=1)},{icon:t.withCtx(()=>[t.createVNode(y)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-4 sm:gap-6",d.value.length===1?"grid-cols-1":"grid-cols-3"])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,_=>(t.openBlock(),t.createElementBlock("div",{key:_,class:"flex flex-col gap-2"},[t.createElementVNode("div",nk,t.toDisplayString(_),1),t.createElementVNode("div",ik,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(cf),(k,x)=>(t.openBlock(),t.createElementBlock("button",{key:k,type:"button",class:t.normalizeClass(["sc-month cursor-pointer rounded-lg px-1 py-2.5 text-sm",h(_,x)]),onPointerdown:t.withModifiers(v=>t.unref(f).pointerDownHandler(_*12+x),["prevent"]),onPointerenter:v=>t.unref(f).pointerEnterHandler(_*12+x),onKeydown:[t.withKeys(t.withModifiers(v=>t.unref(f).selectHandler(_*12+x),["prevent"]),["enter"]),t.withKeys(t.withModifiers(v=>t.unref(f).selectHandler(_*12+x),["prevent"]),["space"])]},t.toDisplayString(k),43,rk))),128))])]))),128))],2)],36)}}}),ak=fn(sk,[["__scopeId","data-v-dd09a19d"]]),lk={class:"sc-date-range-sidebar flex flex-col gap-1"},ck={class:"flex items-center justify-center gap-1"},dk={class:"min-w-12 text-center font-semibold"},uk={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},fk={},hk=t.defineComponent({...fk,__name:"month-year-sidebar",props:{year:{},month:{}},emits:["update:year","select-month","today"],setup(n,{emit:e}){const i=e;return(r,o)=>{const s=F.NButton;return t.openBlock(),t.createElementBlock("div",lk,[t.createElementVNode("div",ck,[t.createVNode(s,{size:"small",quaternary:"",onClick:o[0]||(o[0]=a=>i("update:year",n.year-1))},{default:t.withCtx(()=>[...o[3]||(o[3]=[t.createTextVNode(" ‹ ",-1)])]),_:1}),t.createElementVNode("span",dk,t.toDisplayString(n.year),1),t.createVNode(s,{size:"small",quaternary:"",onClick:o[1]||(o[1]=a=>i("update:year",n.year+1))},{default:t.withCtx(()=>[...o[4]||(o[4]=[t.createTextVNode(" › ",-1)])]),_:1})]),t.createElementVNode("div",uk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(cf),(a,l)=>(t.openBlock(),t.createBlock(s,{key:a,size:"small",quaternary:"",type:l===n.month?"primary":"default",onClick:c=>i("select-month",l)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a),1)]),_:2},1032,["type","onClick"]))),128))]),t.createVNode(s,{size:"small",text:"",type:"info",onClick:o[2]||(o[2]=a=>i("today"))},{default:t.withCtx(()=>[...o[5]||(o[5]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})])}}}),mk={},pf=t.defineComponent({...mk,__name:"date-range-input",props:{clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},value:{default:null},dateFormat:{default:()=>j.useBaseConfigStateStore().config.dateFormats.uiDate}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),s=t.ref(null),a=t.ref(!1),l=t.ref(0),c=t.ref(i.value&&xe.isValid(i.value)?i.value:new Date),d=t.computed(()=>{const k=i.value&&xe.isValid(i.value)?i.value:c.value;return k.getFullYear()===c.value.getFullYear()?k.getMonth():null});let u=0;const f=k=>{var x,v;(v=(x=k.target)==null?void 0:x.closest)!=null&&v.call(x,".n-base-clear")&&(u=performance.now())},h=k=>{k&&performance.now()-u<300||(a.value=k,k&&(c.value=i.value&&xe.isValid(i.value)?i.value:new Date))},p=k=>{r("update:value",k===null?null:new Date(k))},m=(k,x)=>{const v=new Date(k,x,1);if(c.value=v,i.value&&xe.isValid(i.value)){const B=Math.min(xe.getDate(i.value),xe.getDaysInMonth(v));r("update:value",new Date(k,x,B));return}l.value+=1,t.nextTick().then(()=>{var B;return(B=s.value)==null?void 0:B.focus()})},g=(k,x)=>{c.value=xe.addYears(xe.addMonths(c.value,k),x)},b=k=>{m(k,c.value.getMonth())},y=k=>{m(c.value.getFullYear(),k)},_=()=>{a.value=!1,r("update:value",new Date)};return(k,x)=>{const v=F.NButton,B=F.NDatePicker;return t.openBlock(),t.createBlock(B,{ref_key:"pickerReference",ref:s,key:l.value,value:i.value?i.value.getTime():null,show:a.value,clearable:n.clearable,disabled:n.disabled,placeholder:n.placeholder,format:n.dateFormat,actions:[],"default-calendar-start-time":c.value.getTime(),type:"date",class:"w-full min-w-0",onMousedownCapture:f,"onUpdate:show":h,"onUpdate:value":p,onNextMonth:x[0]||(x[0]=w=>g(1,0)),onPrevMonth:x[1]||(x[1]=w=>g(-1,0)),onNextYear:x[2]||(x[2]=w=>g(0,1)),onPrevYear:x[3]||(x[3]=w=>g(0,-1))},{footer:t.withCtx(()=>[t.unref(o)?(t.openBlock(),t.createBlock(v,{key:1,size:"small",text:"",type:"info",onClick:_},{default:t.withCtx(()=>[...x[4]||(x[4]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})):(t.openBlock(),t.createBlock(hk,{key:0,year:c.value.getFullYear(),month:d.value,"onUpdate:year":b,onSelectMonth:y,onToday:_},null,8,["year","month"]))]),_:1},8,["value","show","clearable","disabled","placeholder","format","default-calendar-start-time"])}}}),pk={key:0,class:"text-gray-400"},gk={},gf=t.defineComponent({...gk,__name:"date-range-fields",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},from:{default:null},to:{default:null},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:from","update:to"],setup(n,{emit:e}){const i=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),r=e;return(o,s)=>{var a,l;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["flex w-full min-w-0 gap-1",t.unref(i)?"flex-col":"flex-row items-center"])},[t.createVNode(pf,{value:n.from,clearable:n.clearable,disabled:(a=n.disabled)==null?void 0:a.from,placeholder:n.placeholderFrom,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[0]||(s[0]=c=>r("update:from",c))},null,8,["value","clearable","disabled","placeholder","date-format"]),t.unref(i)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",pk," – ")),t.createVNode(pf,{value:n.to,clearable:n.clearable,disabled:(l=n.disabled)==null?void 0:l.to,placeholder:n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[1]||(s[1]=c=>r("update:to",c))},null,8,["value","clearable","disabled","placeholder","date-format"])],2)}}}),yk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function bk(n,e){return t.openBlock(),t.createElementBlock("svg",yk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M7 11h2v2H7zm14-6v14c0 1.11-.89 2-2 2H5a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h1V1h2v2h8V1h2v2h1a2 2 0 0 1 2 2M5 7h14V5H5zm14 12V9H5v10zm-4-6v-2h2v2zm-4 0v-2h2v2zm-4 2h2v2H7zm8 2v-2h2v2zm-4 0v-2h2v2z"},null,-1)])])}const _k=t.markRaw({name:"mdi-calendar-month-outline",render:bk}),wk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xk(n,e){return t.openBlock(),t.createElementBlock("svg",wk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m16 11.78l4.24-7.33l1.73 1l-5.23 9.05l-6.51-3.75L5.46 19H22v2H2V3h2v14.54L9.5 8z"},null,-1)])])}const kk=t.markRaw({name:"mdi-chart-line",render:xk}),Ck={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function vk(n,e){return t.openBlock(),t.createElementBlock("svg",Ck,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22 21H2V3h2v16h2v-9h4v9h2V6h4v13h2v-5h4z"},null,-1)])])}const Sk=t.markRaw({name:"mdi-chart-bar",render:vk}),Bk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Nk(n,e){return t.openBlock(),t.createElementBlock("svg",Bk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M5 3h1V1h2v2h8V1h2v2h1c1.11 0 2 .89 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m0 16h14V9H5zM5 7h14V5H5zm12 4v2H7v-2z"},null,-1)])])}const Tk=t.markRaw({name:"mdi-calendar-week-outline",render:Nk}),$k={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ek(n,e){return t.openBlock(),t.createElementBlock("svg",$k,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M19 3h-1V1h-2v2H8V1H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2m0 16H5V9h14zm0-12H5V5h14M7 11h5v5H7"},null,-1)])])}const Rk=t.markRaw({name:"mdi-calendar-today-outline",render:Ek}),Pk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fk(n,e){return t.openBlock(),t.createElementBlock("svg",Pk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M12 8a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 2a2 2 0 0 0-2 2a2 2 0 0 0 2 2a2 2 0 0 0 2-2a2 2 0 0 0-2-2m-2 12c-.25 0-.46-.18-.5-.42l-.37-2.65c-.63-.25-1.17-.59-1.69-.99l-2.49 1.01c-.22.08-.49 0-.61-.22l-2-3.46a.493.493 0 0 1 .12-.64l2.11-1.66L4.5 12l.07-1l-2.11-1.63a.493.493 0 0 1-.12-.64l2-3.46c.12-.22.39-.31.61-.22l2.49 1c.52-.39 1.06-.73 1.69-.98l.37-2.65c.04-.24.25-.42.5-.42h4c.25 0 .46.18.5.42l.37 2.65c.63.25 1.17.59 1.69.98l2.49-1c.22-.09.49 0 .61.22l2 3.46c.13.22.07.49-.12.64L19.43 11l.07 1l-.07 1l2.11 1.63c.19.15.25.42.12.64l-2 3.46c-.12.22-.39.31-.61.22l-2.49-1c-.52.39-1.06.73-1.69.98l-.37 2.65c-.04.24-.25.42-.5.42zm1.25-18l-.37 2.61c-1.2.25-2.26.89-3.03 1.78L5.44 7.35l-.75 1.3L6.8 10.2a5.55 5.55 0 0 0 0 3.6l-2.12 1.56l.75 1.3l2.43-1.04c.77.88 1.82 1.52 3.01 1.76l.37 2.62h1.52l.37-2.61c1.19-.25 2.24-.89 3.01-1.77l2.43 1.04l.75-1.3l-2.12-1.55c.4-1.17.4-2.44 0-3.61l2.11-1.55l-.75-1.3l-2.41 1.04a5.42 5.42 0 0 0-3.03-1.77L12.75 4z"},null,-1)])])}const Vk=t.markRaw({name:"mdi-cog-outline",render:Fk}),Mk={class:"grid gap-x-6 gap-y-4 pr-3 sm:grid-cols-2"},Ik={class:"font-medium"},Ak={key:0,class:"pt-1 text-xs text-gray-500"},Ok={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},zk={class:"flex items-center gap-3"},Dk={class:"text-sm text-gray-600"},Lk={class:"flex gap-2"},Hk={},Wk=t.defineComponent({...Hk,__name:"quick-periods-settings",props:{show:{type:Boolean},selectedKeys:{}},emits:["update:show","save"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution("100%","90%","40rem"),s=j.DateTimeProvider.standardPeriods(),a=j.STANDARD_PERIOD_GROUPS.map(u=>({key:u.key,label:u.label,sections:hf(s,u.key)})),l=t.ref([]),c=t.computed(()=>{const u=l.value.length;return`Выбрано: ${u} ${j.pluralize(u,["период","периода","периодов"])}`}),d=()=>{r("save",[...l.value]),r("update:show",!1)};return t.watch(()=>i.show,u=>{u&&(l.value=[...i.selectedKeys])}),(u,f)=>{const h=F.NCheckbox,p=F.NCheckboxGroup,m=F.NScrollbar,g=F.NButton,b=F.NModal;return t.openBlock(),t.createBlock(b,{show:n.show,preset:"card",title:"Настройка быстрого выбора",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":f[4]||(f[4]=y=>r("update:show",y))},{footer:t.withCtx(()=>[t.createElementVNode("div",Ok,[t.createElementVNode("div",zk,[t.createElementVNode("span",Dk,t.toDisplayString(c.value),1),t.createVNode(g,{text:"",type:"info",onClick:f[1]||(f[1]=y=>l.value=[...t.unref(lf)])},{default:t.withCtx(()=>[...f[5]||(f[5]=[t.createTextVNode(" По умолчанию ",-1)])]),_:1}),t.createVNode(g,{text:"",type:"info",disabled:l.value.length===0,onClick:f[2]||(f[2]=y=>l.value=[])},{default:t.withCtx(()=>[...f[6]||(f[6]=[t.createTextVNode(" Снять все ",-1)])]),_:1},8,["disabled"])]),t.createElementVNode("div",Lk,[t.createVNode(g,{type:"primary",onClick:d},{default:t.withCtx(()=>[...f[7]||(f[7]=[t.createTextVNode(" Сохранить ",-1)])]),_:1}),t.createVNode(g,{onClick:f[3]||(f[3]=y=>r("update:show",!1))},{default:t.withCtx(()=>[...f[8]||(f[8]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createVNode(m,{class:"max-h-[60vh]"},{default:t.withCtx(()=>[t.createVNode(p,{value:l.value,"onUpdate:value":f[0]||(f[0]=y=>l.value=y)},{default:t.withCtx(()=>[t.createElementVNode("div",Mk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a),y=>(t.openBlock(),t.createElementBlock("div",{key:y.key,class:"flex flex-col gap-1.5"},[t.createElementVNode("div",Ik,t.toDisplayString(y.label),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.sections,_=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:_.key},[_.label?(t.openBlock(),t.createElementBlock("div",Ak,t.toDisplayString(_.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.children,k=>(t.openBlock(),t.createBlock(h,{key:k.value,value:k.value,label:k.label},null,8,["value","label"]))),128))],64))),128))]))),128))])]),_:1},8,["value"])]),_:1})]),_:1},8,["show","style"])}}}),jk={class:"flex flex-col gap-2"},qk={class:"flex items-center gap-2"},Xk={class:"flex gap-2 px-px pb-4 pt-px"},Yk={key:0,class:"text-sm text-gray-500"},Uk={},Kk=t.defineComponent({...Uk,__name:"quick-periods",props:{from:{},to:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o=j.DateTimeProvider.standardPeriods(),s=()=>{const f=af,h=j.PreferencesStorageProvider.getActualDataFromStorage(f);return(M.isArray(h)?h:lf).filter(m=>M.isString(m)&&m in o)},a=t.ref(s()),l=t.ref(!1),c=t.computed(()=>Object.entries(o).filter(([f])=>a.value.includes(f)).map(([f,h])=>({value:f,label:h.label,item:h,group:h.group}))),d=t.computed(()=>{const f=i.from?Ti(i.from):null,h=i.to?Ti(i.to):null;if(f===null||h===null)return null;const p=c.value.find(m=>{const{from:g,to:b}=m.item;return!g||!b?!1:Ti(g)===f&&Ti(b)===h});return p?String(p.value):null}),u=f=>{a.value=f;const h=af;j.PreferencesStorageProvider.saveActualDataToStorage(h,f,xe.addYears(xe.startOfToday(),1))};return(f,h)=>{const p=Vk,m=F.NButton,g=Rk,b=Tk,y=Sk,_=kk,k=_k,x=F.NScrollbar;return t.openBlock(),t.createElementBlock("div",jk,[t.createElementVNode("div",qk,[h[3]||(h[3]=t.createElementVNode("span",{class:"text-sm font-medium text-gray-700"},"Быстрый выбор",-1)),t.createVNode(m,{size:"tiny",quaternary:"",circle:"","aria-label":"Настроить быстрый выбор",onClick:h[0]||(h[0]=v=>l.value=!0)},{icon:t.withCtx(()=>[t.createVNode(p)]),_:1})]),t.createVNode(x,{"x-scrollable":""},{default:t.withCtx(()=>[t.createElementVNode("div",Xk,[c.value.length===0?(t.openBlock(),t.createElementBlock("span",Yk," Периоды не выбраны ")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,v=>(t.openBlock(),t.createBlock(m,{key:v.value,type:v.value===d.value?"primary":"default",ghost:v.value===d.value,"theme-overrides":t.unref(Hx),class:"shrink-0",onClick:B=>r("apply",v),onMouseenter:B=>r("preview",v),onMouseleave:h[1]||(h[1]=B=>r("preview"))},{icon:t.withCtx(()=>[v.group==="day"?(t.openBlock(),t.createBlock(g,{key:0})):v.group==="week"||v.group==="decade"?(t.openBlock(),t.createBlock(b,{key:1})):v.group==="quarter"||v.group==="halfYear"?(t.openBlock(),t.createBlock(y,{key:2})):v.group==="other"?(t.openBlock(),t.createBlock(_,{key:3})):(t.openBlock(),t.createBlock(k,{key:4}))]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(v.label),1)]),_:2},1032,["type","ghost","theme-overrides","onClick","onMouseenter"]))),128))])]),_:1}),t.createVNode(Wk,{show:l.value,"onUpdate:show":h[2]||(h[2]=v=>l.value=v),"selected-keys":a.value,onSave:u},null,8,["show","selected-keys"])])}}}),Gk={class:"flex flex-col items-stretch gap-3 sm:flex-row"},Zk={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},Qk={class:"flex flex-col items-stretch pr-3"},Jk={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},e2={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},t2={},n2=t.defineComponent({...t2,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o="custom",s=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),a=j.DateTimeProvider.standardPeriods(),l=t.ref(j.STANDARD_PERIOD_GROUPS[0].key),c=t.computed(()=>{const u=j.STANDARD_PERIOD_GROUPS.map(f=>({key:f.key,value:f.key,label:f.label}));return M.isEmpty(i.customPeriods)||u.push({key:o,value:o,label:"Пользовательские"}),u}),d=t.computed(()=>l.value===o?[{type:"group",key:o,children:Ra(i.customPeriods??{})}]:hf(a,l.value));return(u,f)=>{const h=F.NButton,p=F.NScrollbar,m=F.NSelect,g=F.NMenu;return t.openBlock(),t.createElementBlock("div",Gk,[t.createElementVNode("div",Zk,[t.createVNode(p,{class:"max-h-96"},{default:t.withCtx(()=>[t.createElementVNode("div",Qk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,b=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:b.key},[b.label?(t.openBlock(),t.createElementBlock("div",Jk,t.toDisplayString(b.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.children,y=>(t.openBlock(),t.createBlock(h,{key:y.value,size:"small",quaternary:"",type:y.value===n.activeKey?"primary":"default",class:"justify-start",onClick:_=>r("apply",y),onMouseenter:_=>r("preview",y),onMouseleave:f[0]||(f[0]=_=>r("preview"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["type","onClick","onMouseenter"]))),128))],64))),128))])]),_:1})]),t.unref(s)?(t.openBlock(),t.createBlock(m,{key:0,value:l.value,options:c.value,class:"order-1","onUpdate:value":f[1]||(f[1]=b=>l.value=b)},null,8,["value","options"])):(t.openBlock(),t.createElementBlock("div",e2,[t.createVNode(g,{value:l.value,options:c.value,mode:"vertical","onUpdate:value":f[2]||(f[2]=b=>l.value=b)},null,8,["value","options"])]))])}}}),i2={class:"flex flex-col gap-3"},r2={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},o2={key:1,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},s2={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},a2={class:"flex gap-2"},l2={},c2=t.defineComponent({...l2,__name:"date-range-dialog",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},show:{type:Boolean},dateRange:{default:void 0},customPeriods:{default:void 0},dateFormat:{default:void 0}},emits:["update:show","select"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution("100%","90%","48rem"),s=t.ref("custom"),a=t.ref("months"),l=t.computed(()=>a.value==="months"?"Показать по дням":"Показать по месяцам"),c=()=>j.PreferencesStorageProvider.getActualDataFromStorage(of)==="standard"?"standard":"custom",d=()=>j.PreferencesStorageProvider.getActualDataFromStorage(sf)==="days"?"days":"months",u=(C,$)=>{j.PreferencesStorageProvider.saveActualDataToStorage(C,$,xe.addYears(xe.startOfToday(),1))},f=t.ref({}),h=t.ref(null),p=t.ref(null),m=t.computed(()=>h.value??f.value),g=(C,$)=>{var R,O;const E=(R=i.disabled)!=null&&R.from?f.value.from:C,I=(O=i.disabled)!=null&&O.to?f.value.to:$;h.value=null,f.value=ff(E,I,i.disabled)},b=C=>{p.value=null,g(C,f.value.to)},y=C=>{p.value=null,g(f.value.from,C)},_=()=>{p.value=null,g(null,null)},k=C=>{p.value=null,g(C.from,C.to)},x=C=>{const $=C.item;g($.from,$.to),p.value=String(C.value)},v=C=>{const $=C==null?void 0:C.item;h.value=$?{from:$.from,to:$.to}:null},B=()=>{h.value=null,s.value=s.value==="custom"?"standard":"custom",u(of,s.value)},w=()=>{a.value=a.value==="months"?"days":"months",u(sf,a.value)},T=()=>{r("select",f.value),r("update:show",!1)};return t.watch(()=>i.show,C=>{C&&(s.value=c(),a.value=d(),p.value=null,h.value=null,f.value={...i.dateRange})}),(C,$)=>{const E=F.NButton,I=Ax,R=Vx,O=F.NTooltip,U=F.NModal;return t.openBlock(),t.createBlock(U,{show:n.show,preset:"card",title:"Выберите период",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":$[1]||($[1]=Q=>r("update:show",Q))},{footer:t.withCtx(()=>[t.createElementVNode("div",s2,[t.createVNode(E,{text:"",type:"info",onClick:B},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),t.createElementVNode("div",a2,[t.createVNode(E,{type:"primary",onClick:T},{default:t.withCtx(()=>[...$[3]||($[3]=[t.createTextVNode(" Выбрать ",-1)])]),_:1}),t.createVNode(E,{onClick:$[0]||($[0]=Q=>r("update:show",!1))},{default:t.withCtx(()=>[...$[4]||($[4]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createElementVNode("div",i2,[s.value==="custom"?(t.openBlock(),t.createBlock(Kk,{key:0,from:f.value.from,to:f.value.to,onApply:x,onPreview:v},null,8,["from","to"])):t.createCommentVNode("",!0),t.createElementVNode("div",r2,[t.createVNode(gf,{from:m.value.from,to:m.value.to,clearable:n.clearable,disabled:n.disabled,"date-format":n.dateFormat,class:"flex-1","onUpdate:from":b,"onUpdate:to":y},null,8,["from","to","clearable","disabled","date-format"]),n.clearable?(t.openBlock(),t.createBlock(E,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:_},{default:t.withCtx(()=>[...$[2]||($[2]=[t.createTextVNode(" Очистить период ",-1)])]),_:1})):t.createCommentVNode("",!0)]),s.value==="custom"?(t.openBlock(),t.createElementBlock("div",o2,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.value==="months"?ak:Jx),{from:f.value.from,to:f.value.to,onSelect:k},{actions:t.withCtx(()=>[t.createVNode(O,{placement:"top",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(E,{size:"small","aria-label":l.value,"theme-overrides":t.unref(Ar),onClick:w},{icon:t.withCtx(()=>[a.value==="months"?(t.openBlock(),t.createBlock(I,{key:0})):(t.openBlock(),t.createBlock(R,{key:1}))]),_:1},8,["aria-label","theme-overrides"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(l.value),1)]),_:1})]),_:1},40,["from","to"]))])):(t.openBlock(),t.createBlock(n2,{key:2,"active-key":p.value,"custom-periods":n.customPeriods,onApply:x,onPreview:v},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),d2={class:"flex w-full min-w-0 items-center gap-1"},u2={},f2=t.defineComponent({...u2,__name:"date-range",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},dateRange:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:date-range"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.computed(()=>{const u={...i.useDefaultPredefinedDateRanges?j.DateTimeProvider.defaultDateRanges():{},...i.predefinedDateRanges};return M.isEmpty(u)?void 0:u}),a=(u,f)=>{r("update:date-range",ff(u,f,i.disabled))},l=u=>{var f;a(u,(f=i.dateRange)==null?void 0:f.to)},c=u=>{var f;a((f=i.dateRange)==null?void 0:f.from,u)},d=u=>{a(u.from,u.to)};return(u,f)=>{var m,g,b,y;const h=Rx,p=F.NButton;return t.openBlock(),t.createElementBlock("div",d2,[t.createVNode(gf,{from:(m=n.dateRange)==null?void 0:m.from,to:(g=n.dateRange)==null?void 0:g.to,clearable:n.clearable,disabled:n.disabled,"placeholder-from":n.placeholderFrom,"placeholder-to":n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:from":l,"onUpdate:to":c},null,8,["from","to","clearable","disabled","placeholder-from","placeholder-to","date-format"]),t.createVNode(p,{disabled:!!((b=n.disabled)!=null&&b.from&&((y=n.disabled)!=null&&y.to)),title:"Выбрать период","aria-label":"Выбрать период",onClick:f[0]||(f[0]=_=>o.value=!0)},{default:t.withCtx(()=>[t.createVNode(h)]),_:1},8,["disabled"]),t.createVNode(c2,{show:o.value,"onUpdate:show":f[1]||(f[1]=_=>o.value=_),"date-range":n.dateRange,clearable:n.clearable,disabled:n.disabled,"custom-periods":s.value,"date-format":n.dateFormat,onSelect:d},null,8,["show","date-range","clearable","disabled","custom-periods","date-format"])])}}}),h2={class:"sc-lbl-date text-nowrap"},m2={},Ko=t.defineComponent({...m2,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean},isShowTime:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>xe.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=t.computed(()=>xe.format(e.date,"HH:mm"));return(o,s)=>(t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-col":n.isTimeOnSecondLine})},[t.createElementVNode("span",h2,t.toDisplayString(i.value),1),n.isShowTime?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([{"text-sc-grey":n.isTimeSecondary,"ml-1":!n.isTimeOnSecondLine},"sc-lbl-time"])},t.toDisplayString(r.value),3)):t.createCommentVNode("",!0)],2))}}),p2={},g2=t.defineComponent({...p2,__name:"debt",props:{debt:{default:0},showLabel:{type:Boolean,default:!1},wrapAsSmall:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{let r="";return(e.showLabel??!1)&&(e.debt>0?r="Переплата: ":e.debt<0&&(r="Задолженность: ")),r});return(r,o)=>n.debt!==0?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"text-sm":n.wrapAsSmall})},[t.createTextVNode(t.toDisplayString(i.value)+" ",1),t.createElementVNode("span",{class:t.normalizeClass({"text-green-700":n.debt>0,"text-red-700":n.debt<0})},t.toDisplayString(n.debt)+" ₽ ",3)],2)):t.createCommentVNode("",!0)}}),y2={class:"flex flex-row gap-2.5"},b2={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},_2={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},w2={class:"mb-0.5 sm:mb-0 sm:ml-3"},x2={},k2=t.defineComponent({...x2,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(n){return(e,i)=>{const r=Uo,o=F.NButton,s=F.NPopover;return t.openBlock(),t.createElementBlock("div",y2,[t.createElementVNode("div",b2,[t.renderSlot(e.$slots,"main")]),t.createElementVNode("div",null,[t.createElementVNode("div",_2,[t.renderSlot(e.$slots,"extra-buttons"),t.createElementVNode("div",w2,[n.showCloseButton?(t.openBlock(),t.createBlock(s,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(o,{size:"small",type:"error",onClick:i[0]||(i[0]=a=>e.$emit("close"))},{default:t.withCtx(()=>[t.createVNode(r)]),_:1})]),default:t.withCtx(()=>[i[1]||(i[1]=t.createTextVNode(" Закрыть ",-1))]),_:1})):t.createCommentVNode("",!0)])])])])}}}),C2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function v2(n,e){return t.openBlock(),t.createElementBlock("svg",C2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const S2=t.markRaw({name:"ion-checkmark-done-sharp",render:v2}),B2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function N2(n,e){return t.openBlock(),t.createElementBlock("svg",B2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),t.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const T2=t.markRaw({name:"ion-options-outline",render:N2}),$2={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},E2={class:"flex-auto"},R2={class:"sticky top-0 flex flex-none flex-col justify-start gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},P2={class:"flex flex-none flex-col-reverse justify-end gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},F2={},Pa=t.defineComponent({...F2,__name:"inline-view",props:{disabled:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!1},showApplyButton:{type:Boolean,default:!1},showCancelButton:{type:Boolean,default:!1}},emits:["edit","apply","cancel"],setup(n,{emit:e}){const i=e,r=t.ref(!1),o=()=>{i("edit")},s=()=>{r.value=!1},a=()=>{r.value=!0,i("apply",s)},l=()=>{i("cancel",s)};return(c,d)=>{const u=T2,f=F.NButton,h=F.NPopover,p=S2,m=Uo;return t.openBlock(),t.createElementBlock("div",$2,[t.createElementVNode("div",E2,[t.renderSlot(c.$slots,"default")]),t.createElementVNode("div",null,[t.createElementVNode("div",R2,[t.createElementVNode("div",P2,[n.showEditButton?(t.openBlock(),t.createBlock(h,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[0]||(d[0]=t.createTextVNode(" Редактировать данные ",-1))]),_:1})):t.createCommentVNode("",!0),n.showApplyButton?(t.openBlock(),t.createBlock(h,{key:1,disabled:r.value,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"primary",size:"small",onClick:a},{default:t.withCtx(()=>[t.createVNode(p)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[1]||(d[1]=t.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),n.showCancelButton?(t.openBlock(),t.createBlock(h,{key:2,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"error",size:"small",onClick:l},{default:t.withCtx(()=>[t.createVNode(m)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[2]||(d[2]=t.createTextVNode(" Отменить изменения ",-1))]),_:1})):t.createCommentVNode("",!0)]),t.renderSlot(c.$slots,"extra-buttons")])])])}}}),V2={},yf=t.defineComponent({...V2,__name:"inline-editable-item",props:{disabled:{type:Boolean,default:!1},showEditor:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!0}},emits:["editor:apply","editor:cancel"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.showEditor),s=l=>{r("editor:apply",d=>{o.value=!d,l()})},a=l=>{o.value=!1,l(),r("editor:cancel")};return t.onMounted(()=>{t.watch(()=>i.showEditor,l=>{o.value=l})}),(l,c)=>(t.openBlock(),t.createElementBlock("div",null,[o.value?(t.openBlock(),t.createBlock(Pa,{key:1,disabled:n.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:s,onCancel:a},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-editor-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(t.openBlock(),t.createBlock(Pa,{key:0,disabled:n.disabled,"show-edit-button":n.showEditButton,onEdit:c[0]||(c[0]=d=>o.value=!0)},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-viewer-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),M2={key:0,class:"whitespace-pre-line"},I2={key:1,class:"text-sc-dark-grey"},A2={},O2=t.defineComponent({...A2,__name:"comment-editor",props:{disabled:{type:Boolean,default:!1},comment:{default:""}},emits:["update:comment"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.comment);t.watch(()=>o.value,l=>{o.value=l});const s=l=>{r("update:comment",o.value,l)},a=()=>{o.value=i.comment};return(l,c)=>{const d=F.NInput;return t.openBlock(),t.createBlock(yf,{disabled:n.disabled,"onEditor:apply":s,"onEditor:cancel":a},{viewer:t.withCtx(()=>[t.createElementVNode("div",null,[n.comment?(t.openBlock(),t.createElementBlock("span",M2,t.toDisplayString(n.comment),1)):(t.openBlock(),t.createElementBlock("span",I2," - Комментарий отсутствует - "))])]),editor:t.withCtx(()=>[t.createVNode(d,{value:o.value,"onUpdate:value":c[0]||(c[0]=u=>o.value=u),clearable:!0,type:"textarea"},null,8,["value"])]),_:1},8,["disabled"])}}}),z2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function D2(n,e){return t.openBlock(),t.createElementBlock("svg",z2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 176h40a40 40 0 0 1 40 40v208a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V216a40 40 0 0 1 40-40h40"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const L2=t.markRaw({name:"ion-download-outline",render:D2}),H2={},W2=t.defineComponent({...H2,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{},isError:{type:Boolean}},emits:["update:file"],setup(n,{emit:e}){const i=n,r=e,o=t.ref([]),s=t.computed(()=>o.value.map(l=>(l.status=i.isError?"error":"finished",l))),a=l=>{o.value=l;const c={name:"",content:""};if(l.length===0){r("update:file",null);return}const d=l[0];c.name=d.name;const u=new FileReader;u.addEventListener("load",()=>{c.content=u.result??"",r("update:file",c)}),u.readAsDataURL(d.file)};return(l,c)=>{const d=L2;return t.openBlock(),t.createBlock(t.unref(F.NUpload),{"file-list":s.value,"default-upload":!1,max:1,"show-retry-button":!1,action:"",accept:n.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":a},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NUploadDragger),null,{default:t.withCtx(()=>[t.renderSlot(l.$slots,"dragged-area",{},()=>[t.createElementVNode("div",null,[t.createVNode(d,{class:"text-2xl"}),t.createElementVNode("div",null,t.toDisplayString(n.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["file-list","accept"])}}}),j2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function q2(n,e){return t.openBlock(),t.createElementBlock("svg",j2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0 0 80 446.25h340.89a32 32 0 0 0 28.18-47.17m-198.6-1.83a20 20 0 1 1 20-20a20 20 0 0 1-20 20m21.72-201.15l-5.74 122a16 16 0 0 1-32 0l-5.74-121.95a21.73 21.73 0 0 1 21.5-22.69h.21a21.74 21.74 0 0 1 21.73 22.7Z"},null,-1)])])}const X2=t.markRaw({name:"ion-warning",render:q2}),Y2={},U2=t.defineComponent({...Y2,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(n){return(e,i)=>{const r=X2,o=F.NPopover;return t.openBlock(),t.createBlock(o,{disabled:n.popoverText.length===0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(r,{class:t.normalizeClass(`ml-0.5 ${n.iconClass}`)},null,8,["class"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.popoverText),1)]),_:1},8,["disabled"])}}}),K2={},G2=t.defineComponent({...K2,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.value),s=t.computed(()=>t.inject("debounce-input-time",i.debounceTime)),a=M.debounce(()=>r("update:value",o.value),s.value),l=c=>{o.value=c,a()};return t.watch(()=>i.value,c=>{o.value=c}),(c,d)=>(t.openBlock(),t.createBlock(t.unref(F.NInput),{value:o.value,"onUpdate:value":[d[0]||(d[0]=u=>o.value=u),l],clearable:n.clearable,placeholder:n.placeholder},{prefix:t.withCtx(()=>[t.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),Z2={},Q2=t.defineComponent({...Z2,__name:"debounced-input-number",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:500},placeholder:{default:""},min:{default:void 0},max:{default:void 0},step:{default:1},validator:{type:Function,default:void 0},parse:{type:Function,default:void 0},showButton:{type:Boolean,default:!0}},emits:["update:value","keydown","input","focus"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.computed(()=>t.inject("debounce-input-time",r.debounceTime)),l=M.debounce(()=>o("update:value",s.value),a.value),c=p=>{s.value=p,l()};t.watch(()=>r.value,p=>{s.value=p});const d=t.ref(null);return e({focus:()=>{var p;return(p=d.value)==null?void 0:p.focus()},blur:()=>{var p;return(p=d.value)==null?void 0:p.blur()},select:()=>{var p;return(p=d.value)==null?void 0:p.select()}}),(p,m)=>(t.openBlock(),t.createBlock(t.unref(F.NInputNumber),{ref_key:"inputReference",ref:d,value:s.value??null,clearable:n.clearable,parse:n.parse,"show-button":n.showButton,placeholder:n.placeholder,min:n.min,max:n.max,step:n.step,validator:n.validator,"onUpdate:value":c,onKeydown:m[0]||(m[0]=g=>o("keydown",g)),onInput:m[1]||(m[1]=g=>o("input",g)),onFocus:m[2]||(m[2]=g=>o("focus",g))},{prefix:t.withCtx(()=>[t.renderSlot(p.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),J2={},eC=t.defineComponent({...J2,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref((i.value??"").replaceAll(/\D*/g,"")),s=M.debounce(c=>r("update:value",c),i.debounceTime??0),a=c=>{let d="";if(M.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(M.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof xr.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}i.debounceTime?s(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const u=xr.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof xr.ParseError)o.value=d;else throw u}};return t.watch(()=>i.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=o.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),t.onBeforeMount(()=>l(o.value??"")),(c,d)=>(t.openBlock(),t.createBlock(t.unref(Sm.VueTelInput),{modelValue:o.value,"onUpdate:modelValue":[d[0]||(d[0]=u=>o.value=u),a],"auto-default-country":!1,"auto-format":!0,"default-country":n.defaultCountry,disabled:n.disabled,"input-options":{placeholder:n.placeholder},"preferred-countries":n.preferredCountries,"only-countries":n.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),tC=fn(eC,[["__scopeId","data-v-751dbb0e"]]),nC={class:"mb-7 grid grid-cols-2 gap-3.5 lg:grid-cols-4"},iC={class:"mb-2 text-[11.5px] font-semibold uppercase text-gray-500"},rC={},oC=t.defineComponent({...rC,__name:"kpi-grid",props:{items:{},isLoading:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",nC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,r=>(t.openBlock(),t.createElementBlock("div",{key:r.label,class:"rounded-lg border border-solid border-gray-200 px-4 py-4"},[t.createElementVNode("div",iC,t.toDisplayString(r.label),1),t.createElementVNode("div",{class:t.normalizeClass(["text-[25px] font-bold",r.valueClass])},t.toDisplayString(n.isLoading?"…":r.value),3),t.createElementVNode("div",{class:t.normalizeClass(["mt-1.5 text-xs font-medium",r.noteClass])},t.toDisplayString(r.note),3)]))),128))]))}}),sC={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function aC(n,e){return t.openBlock(),t.createElementBlock("svg",sC,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"},null,-1)])])}const lC=t.markRaw({name:"tabler-external-link",render:aC}),cC={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},dC=["href"],uC={},fC=t.defineComponent({...uC,__name:"external-link",props:{text:{},url:{},description:{}},setup(n){return(e,i)=>{const r=lC,o=F.NTooltip;return t.openBlock(),t.createBlock(o,{disabled:t.unref(M.isUndefined)(n.description),placement:"top-start"},{trigger:t.withCtx(()=>[t.createElementVNode("span",cC,[t.createElementVNode("a",{href:n.url,target:"_blank",class:"no-underline"},t.toDisplayString(n.text),9,dC),t.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.description),1)]),_:1},8,["disabled"])}}}),hC={key:1,class:"h-24"},mC={key:2,class:"flex flex-col gap-3"},pC={},gC=t.defineComponent({...pC,__name:"compact-card-list",props:{isLoading:{type:Boolean},isEmpty:{type:Boolean},emptyDescription:{},pagination:{}},emits:["update:page","update:pageSize"],setup(n,{emit:e}){const i=e,r=[20,50,100];return(o,s)=>(t.openBlock(),t.createBlock(t.unref(F.NSpin),{show:n.isLoading},{default:t.withCtx(()=>[!n.isLoading&&n.isEmpty?(t.openBlock(),t.createBlock(t.unref(F.NEmpty),{key:0,description:n.emptyDescription},null,8,["description"])):n.isLoading&&n.isEmpty?(t.openBlock(),t.createElementBlock("div",hC)):(t.openBlock(),t.createElementBlock("div",mC,[t.renderSlot(o.$slots,"default")])),n.pagination&&n.pagination.itemCount>0?(t.openBlock(),t.createBlock(t.unref(F.NPagination),{key:3,class:"mt-4 flex-wrap justify-center gap-y-2",size:"small",page:n.pagination.page,"page-size":n.pagination.pageSize,"item-count":n.pagination.itemCount,"page-slot":n.pagination.pageSlot,"page-sizes":r,"show-size-picker":!0,prefix:t.unref(Ul),"onUpdate:page":s[0]||(s[0]=a=>i("update:page",a)),"onUpdate:pageSize":s[1]||(s[1]=a=>i("update:pageSize",a))},null,8,["page","page-size","item-count","page-slot","prefix"])):t.createCommentVNode("",!0)]),_:3},8,["show"]))}}),yC={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function bC(n,e){return t.openBlock(),t.createElementBlock("svg",yC,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const _C=t.markRaw({name:"ion-remove-circle-outline",render:bC});let Go=[];const bf=new WeakMap;function wC(){Go.forEach(n=>n(...bf.get(n))),Go=[]}function _f(n,...e){bf.set(n,e),!Go.includes(n)&&Go.push(n)===1&&requestAnimationFrame(wC)}function Or(n,e){let{target:i}=n;for(;i;){if(i.dataset&&i.dataset[e]!==void 0)return!0;i=i.parentElement}return!1}function zr(n){return n.composedPath()[0]||null}function Dr(n){return typeof n=="string"?n.endsWith("px")?Number(n.slice(0,n.length-2)):Number(n):n}function Lr(n){if(n!=null)return typeof n=="number"?`${n}px`:n.endsWith("px")?n:`${n}px`}function yn(n,e){const i=n.trim().split(/\s+/g),r={top:i[0]};switch(i.length){case 1:r.right=i[0],r.bottom=i[0],r.left=i[0];break;case 2:r.right=i[1],r.left=i[1],r.bottom=i[0];break;case 3:r.right=i[1],r.bottom=i[2],r.left=i[1];break;case 4:r.right=i[1],r.bottom=i[2],r.left=i[3];break;default:throw new Error("[seemly/getMargin]:"+n+" is not a valid value.")}return e===void 0?r:r[e]}const wf={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#0FF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000",blanchedalmond:"#FFEBCD",blue:"#00F",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#0FF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#F0F",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#0F0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#F0F",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#F00",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFF",whitesmoke:"#F5F5F5",yellow:"#FF0",yellowgreen:"#9ACD32",transparent:"#0000"};function xC(n,e,i){e/=100,i/=100;let r=(o,s=(o+n/60)%6)=>i-i*e*Math.max(Math.min(s,4-s,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function kC(n,e,i){e/=100,i/=100;let r=e*Math.min(i,1-i),o=(s,a=(s+n/30)%12)=>i-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const Pn="^\\s*",Fn="\\s*$",fi="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Qt="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",$i="([0-9A-Fa-f])",Ei="([0-9A-Fa-f]{2})",xf=new RegExp(`${Pn}hsl\\s*\\(${Qt},${fi},${fi}\\)${Fn}`),kf=new RegExp(`${Pn}hsv\\s*\\(${Qt},${fi},${fi}\\)${Fn}`),Cf=new RegExp(`${Pn}hsla\\s*\\(${Qt},${fi},${fi},${Qt}\\)${Fn}`),vf=new RegExp(`${Pn}hsva\\s*\\(${Qt},${fi},${fi},${Qt}\\)${Fn}`),CC=new RegExp(`${Pn}rgb\\s*\\(${Qt},${Qt},${Qt}\\)${Fn}`),vC=new RegExp(`${Pn}rgba\\s*\\(${Qt},${Qt},${Qt},${Qt}\\)${Fn}`),SC=new RegExp(`${Pn}#${$i}${$i}${$i}${Fn}`),BC=new RegExp(`${Pn}#${Ei}${Ei}${Ei}${Fn}`),NC=new RegExp(`${Pn}#${$i}${$i}${$i}${$i}${Fn}`),TC=new RegExp(`${Pn}#${Ei}${Ei}${Ei}${Ei}${Fn}`);function Yt(n){return parseInt(n,16)}function $C(n){try{let e;if(e=Cf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),Pi(e[13])];if(e=xf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${n}.`)}catch(e){throw e}}function EC(n){try{let e;if(e=vf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),Pi(e[13])];if(e=kf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${n}.`)}catch(e){throw e}}function Ri(n){try{let e;if(e=BC.exec(n))return[Yt(e[1]),Yt(e[2]),Yt(e[3]),1];if(e=CC.exec(n))return[Bt(e[1]),Bt(e[5]),Bt(e[9]),1];if(e=vC.exec(n))return[Bt(e[1]),Bt(e[5]),Bt(e[9]),Pi(e[13])];if(e=SC.exec(n))return[Yt(e[1]+e[1]),Yt(e[2]+e[2]),Yt(e[3]+e[3]),1];if(e=TC.exec(n))return[Yt(e[1]),Yt(e[2]),Yt(e[3]),Pi(Yt(e[4])/255)];if(e=NC.exec(n))return[Yt(e[1]+e[1]),Yt(e[2]+e[2]),Yt(e[3]+e[3]),Pi(Yt(e[4]+e[4])/255)];if(n in wf)return Ri(wf[n]);if(xf.test(n)||Cf.test(n)){const[i,r,o,s]=$C(n);return[...kC(i,r,o),s]}else if(kf.test(n)||vf.test(n)){const[i,r,o,s]=EC(n);return[...xC(i,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${n}.`)}catch(e){throw e}}function RC(n){return n>1?1:n<0?0:n}function Fa(n,e,i,r){return`rgba(${Bt(n)}, ${Bt(e)}, ${Bt(i)}, ${RC(r)})`}function Va(n,e,i,r,o){return Bt((n*e*(1-r)+i*r)/o)}function PC(n,e){Array.isArray(n)||(n=Ri(n)),Array.isArray(e)||(e=Ri(e));const i=n[3],r=e[3],o=Pi(i+r-i*r);return Fa(Va(n[0],i,e[0],r,o),Va(n[1],i,e[1],r,o),Va(n[2],i,e[2],r,o),o)}function De(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Ri(n);return typeof e.alpha=="number"?Fa(i,r,o,e.alpha):Fa(i,r,o,s)}function Zo(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Ri(n),{lightness:a=1,alpha:l=1}=e;return FC([i*a,r*a,o*a,s*l])}function Pi(n){const e=Math.round(Number(n)*100)/100;return e>1?1:e<0?0:e}function Qo(n){const e=Math.round(Number(n));return e>=360||e<0?0:e}function Bt(n){const e=Math.round(Number(n));return e>255?255:e<0?0:e}function hi(n){const e=Math.round(Number(n));return e>100?100:e<0?0:e}function FC(n){const[e,i,r]=n;return 3 in n?`rgba(${Bt(e)}, ${Bt(i)}, ${Bt(r)}, ${Pi(n[3])})`:`rgba(${Bt(e)}, ${Bt(i)}, ${Bt(r)}, 1)`}function VC(n=8){return Math.random().toString(16).slice(2,2+n)}function Sf(n){return Array.isArray(n)?n:[n]}const Ma={STOP:"STOP"};function Bf(n,e){const i=e(n);n.children!==void 0&&i!==Ma.STOP&&n.children.forEach(r=>Bf(r,e))}function MC(n,e={}){const{preserveGroup:i=!1}=e,r=[],o=i?a=>{a.isLeaf||(r.push(a.key),s(a.children))}:a=>{a.isLeaf||(a.isGroup||r.push(a.key),s(a.children))};function s(a){a.forEach(o)}return s(n),r}function IC(n,e){const{isLeaf:i}=n;return i!==void 0?i:!e(n)}function AC(n){return n.children}function OC(n){return n.key}function zC(){return!1}function DC(n,e){const{isLeaf:i}=n;return!(i===!1&&!Array.isArray(e(n)))}function LC(n){return n.disabled===!0}function HC(n,e){return n.isLeaf===!1&&!Array.isArray(e(n))}function WC(n,e){if(n.isLeaf===!0){const i=e(n);if(Array.isArray(i)&&i.length>0)return!0}return!1}function Ia(n){var e;return n==null?[]:Array.isArray(n)?n:(e=n.checkedKeys)!==null&&e!==void 0?e:[]}function Aa(n){var e;return n==null||Array.isArray(n)?[]:(e=n.indeterminateKeys)!==null&&e!==void 0?e:[]}function jC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)||i.add(r)}),Array.from(i)}function qC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)&&i.delete(r)}),Array.from(i)}function XC(n){return(n==null?void 0:n.type)==="group"}function YC(n){const e=new Map;return n.forEach((i,r)=>{e.set(i.key,r)}),i=>{var r;return(r=e.get(i))!==null&&r!==void 0?r:null}}class UC extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function KC(n,e,i,r){return Jo(e.concat(n),i,r,!1)}function GC(n,e){const i=new Set;return n.forEach(r=>{const o=e.treeNodeMap.get(r);if(o!==void 0){let s=o.parent;for(;s!==null&&!(s.disabled||i.has(s.key));)i.add(s.key),s=s.parent}}),i}function ZC(n,e,i,r){const o=Jo(e,i,r,!1),s=Jo(n,i,r,!0),a=GC(n,i),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Oa(n,e){const{checkedKeys:i,keysToCheck:r,keysToUncheck:o,indeterminateKeys:s,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=n;if(!a)return r!==void 0?{checkedKeys:jC(i,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:qC(i,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(i),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let f;o!==void 0?f=ZC(o,i,e,d):r!==void 0?f=KC(r,i,e,d):f=Jo(i,e,d,!1);const h=c==="parent",p=c==="child"||l,m=f,g=new Set,b=Math.max.apply(null,Array.from(u.keys()));for(let y=b;y>=0;y-=1){const _=y===0,k=u.get(y);for(const x of k){if(x.isLeaf)continue;const{key:v,shallowLoaded:B}=x;if(p&&B&&x.children.forEach($=>{!$.disabled&&!$.isLeaf&&$.shallowLoaded&&m.has($.key)&&m.delete($.key)}),x.disabled||!B)continue;let w=!0,T=!1,C=!0;for(const $ of x.children){const E=$.key;if(!$.disabled){if(C&&(C=!1),m.has(E))T=!0;else if(g.has(E)){T=!0,w=!1;break}else if(w=!1,T)break}}w&&!C?(h&&x.children.forEach($=>{!$.disabled&&m.has($.key)&&m.delete($.key)}),m.add(v)):T&&g.add(v),_&&p&&m.has(v)&&m.delete(v)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(g)}}function Jo(n,e,i,r){const{treeNodeMap:o,getChildren:s}=e,a=new Set,l=new Set(n);return n.forEach(c=>{const d=o.get(c);d!==void 0&&Bf(d,u=>{if(u.disabled)return Ma.STOP;const{key:f}=u;if(!a.has(f)&&(a.add(f),l.add(f),HC(u.rawNode,s))){if(r)return Ma.STOP;if(!i)throw new UC}})}),l}function QC(n,{includeGroup:e=!1,includeSelf:i=!0},r){var o;const s=r.treeNodeMap;let a=n==null?null:(o=s.get(n))!==null&&o!==void 0?o:null;const l={keyPath:[],treeNodePath:[],treeNode:a};if(a!=null&&a.ignored)return l.treeNode=null,l;for(;a;)!a.ignored&&(e||!a.isGroup)&&l.treeNodePath.push(a),a=a.parent;return l.treeNodePath.reverse(),i||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function JC(n){if(n.length===0)return null;const e=n[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function ev(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o+1)%r]:o===i.length-1?null:i[o+1]}function Nf(n,e,{loop:i=!1,includeDisabled:r=!1}={}){const o=e==="prev"?tv:ev,s={reverse:e==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===n){if(!a)a=!0;else if(!n.disabled&&!n.isGroup){l=n;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const u=za(d,s);u!==null?l=u:c(o(d,i))}else{const u=o(d,!1);if(u!==null)c(u);else{const f=nv(d);f!=null&&f.isGroup?c(o(f,i)):i&&c(o(d,!0))}}}}return c(n),l}function tv(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o-1+r)%r]:o===0?null:i[o-1]}function nv(n){return n.parent}function za(n,e={}){const{reverse:i=!1}=e,{children:r}=n;if(r){const{length:o}=r,s=i?o-1:0,a=i?-1:o,l=i?-1:1;for(let c=s;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const u=za(d,e);if(u!==null)return u}else return d}}return null}const iv={getChild(){return this.ignored?null:za(this)},getParent(){const{parent:n}=this;return n!=null&&n.isGroup?n.getParent():n},getNext(n={}){return Nf(this,"next",n)},getPrev(n={}){return Nf(this,"prev",n)}};function rv(n,e){const i=e?new Set(e):void 0,r=[];function o(s){s.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||i===void 0||i.has(a.key))&&o(a.children)})}return o(n),r}function ov(n,e){const i=n.key;for(;e;){if(e.key===i)return!0;e=e.parent}return!1}var sv={};function Tf(n,e,i,r,o,s=null,a=0){const l=[];return n.forEach((c,d)=>{var u;sv.NODE_ENV!=="production"&&WC(c,o)&&console.error("[treemate]: node",c,"is invalid");const f=Object.create(r);if(f.rawNode=c,f.siblings=l,f.level=a,f.index=d,f.isFirstChild=d===0,f.isLastChild=d+1===n.length,f.parent=s,!f.ignored){const h=o(c);Array.isArray(h)&&(f.children=Tf(h,e,i,r,o,f,a+1))}l.push(f),e.set(f.key,f),i.has(a)||i.set(a,[]),(u=i.get(a))===null||u===void 0||u.push(f)}),l}function av(n,e={}){var i;const r=new Map,o=new Map,{getDisabled:s=LC,getIgnored:a=zC,getIsGroup:l=XC,getKey:c=OC}=e,d=(i=e.getChildren)!==null&&i!==void 0?i:AC,u=e.ignoreEmptyChildren?x=>{const v=d(x);return Array.isArray(v)?v.length?v:null:v}:d,f=Object.assign({get key(){return c(this.rawNode)},get disabled(){return s(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return IC(this.rawNode,u)},get shallowLoaded(){return DC(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return ov(this,x)}},iv),h=Tf(n,r,o,f,u);function p(x){if(x==null)return null;const v=r.get(x);return v&&!v.isGroup&&!v.ignored?v:null}function m(x){if(x==null)return null;const v=r.get(x);return v&&!v.ignored?v:null}function g(x,v){const B=m(x);return B?B.getPrev(v):null}function b(x,v){const B=m(x);return B?B.getNext(v):null}function y(x){const v=m(x);return v?v.getParent():null}function _(x){const v=m(x);return v?v.getChild():null}const k={treeNodes:h,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return rv(h,x)},getNode:p,getPrev:g,getNext:b,getParent:y,getChild:_,getFirstAvailableNode(){return JC(h)},getPath(x,v={}){return QC(x,v,k)},getCheckedKeys(x,v={}){const{cascade:B=!0,leafOnly:w=!1,checkStrategy:T="all",allowNotLoaded:C=!1}=v;return Oa({checkedKeys:Ia(x),indeterminateKeys:Aa(x),cascade:B,leafOnly:w,checkStrategy:T,allowNotLoaded:C},k)},check(x,v,B={}){const{cascade:w=!0,leafOnly:T=!1,checkStrategy:C="all",allowNotLoaded:$=!1}=B;return Oa({checkedKeys:Ia(v),indeterminateKeys:Aa(v),keysToCheck:x==null?[]:Sf(x),cascade:w,leafOnly:T,checkStrategy:C,allowNotLoaded:$},k)},uncheck(x,v,B={}){const{cascade:w=!0,leafOnly:T=!1,checkStrategy:C="all",allowNotLoaded:$=!1}=B;return Oa({checkedKeys:Ia(v),indeterminateKeys:Aa(v),keysToUncheck:x==null?[]:Sf(x),cascade:w,leafOnly:T,checkStrategy:C,allowNotLoaded:$},k)},getNonLeafKeys(x={}){return MC(h,x)}};return k}function es(n){return n.composedPath()[0]}const lv={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function cv(n,e,i){if(n==="mousemoveoutside"){const r=o=>{e.contains(es(o))||i(o)};return{mousemove:r,touchstart:r}}else if(n==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(es(a))},s=a=>{r&&(e.contains(es(a))||i(a))};return{mousedown:o,mouseup:s,touchstart:o,touchend:s}}return console.error(`[evtd/create-trap-handler]: name \`${n}\` is invalid. This could be a bug of evtd.`),{}}function $f(n,e,i){const r=lv[n];let o=r.get(e);o===void 0&&r.set(e,o=new WeakMap);let s=o.get(i);return s===void 0&&o.set(i,s=cv(n,e,i)),s}function dv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=$f(n,e,i);return Object.keys(o).forEach(s=>{At(s,document,o[s],r)}),!0}return!1}function uv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=$f(n,e,i);return Object.keys(o).forEach(s=>{ht(s,document,o[s],r)}),!0}return!1}function fv(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const n=new WeakMap,e=new WeakMap;function i(){n.set(this,!0)}function r(){n.set(this,!0),e.set(this,!0)}function o(w,T,C){const $=w[T];return w[T]=function(){return C.apply(w,arguments),$.apply(w,arguments)},w}function s(w,T){w[T]=Event.prototype[T]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var w;return(w=a.get(this))!==null&&w!==void 0?w:null}function d(w,T){l!==void 0&&Object.defineProperty(w,"currentTarget",{configurable:!0,enumerable:!0,get:T??l.get})}const u={bubble:{},capture:{}},f={};function h(){const w=function(T){const{type:C,eventPhase:$,bubbles:E}=T,I=es(T);if($===2)return;const R=$===1?"capture":"bubble";let O=I;const U=[];for(;O===null&&(O=window),U.push(O),O!==window;)O=O.parentNode||null;const Q=u.capture[C],G=u.bubble[C];if(o(T,"stopPropagation",i),o(T,"stopImmediatePropagation",r),d(T,c),R==="capture"){if(Q===void 0)return;for(let W=U.length-1;W>=0&&!n.has(T);--W){const D=U[W],L=Q.get(D);if(L!==void 0){a.set(T,D);for(const z of L){if(e.has(T))break;z(T)}}if(W===0&&!E&&G!==void 0){const z=G.get(D);if(z!==void 0)for(const P of z){if(e.has(T))break;P(T)}}}}else if(R==="bubble"){if(G===void 0)return;for(let W=0;W<U.length&&!n.has(T);++W){const D=U[W],L=G.get(D);if(L!==void 0){a.set(T,D);for(const z of L){if(e.has(T))break;z(T)}}}}s(T,"stopPropagation"),s(T,"stopImmediatePropagation"),d(T)};return w.displayName="evtdUnifiedHandler",w}function p(){const w=function(T){const{type:C,eventPhase:$}=T;if($!==2)return;const E=f[C];E!==void 0&&E.forEach(I=>I(T))};return w.displayName="evtdUnifiedWindowEventHandler",w}const m=h(),g=p();function b(w,T){const C=u[w];return C[T]===void 0&&(C[T]=new Map,window.addEventListener(T,m,w==="capture")),C[T]}function y(w){return f[w]===void 0&&(f[w]=new Set,window.addEventListener(w,g)),f[w]}function _(w,T){let C=w.get(T);return C===void 0&&w.set(T,C=new Set),C}function k(w,T,C,$){const E=u[T][C];if(E!==void 0){const I=E.get(w);if(I!==void 0&&I.has($))return!0}return!1}function x(w,T){const C=f[w];return!!(C!==void 0&&C.has(T))}function v(w,T,C,$){let E;if(typeof $=="object"&&$.once===!0?E=Q=>{B(w,T,E,$),C(Q)}:E=C,dv(w,T,E,$))return;const R=$===!0||typeof $=="object"&&$.capture===!0?"capture":"bubble",O=b(R,w),U=_(O,T);if(U.has(E)||U.add(E),T===window){const Q=y(w);Q.has(E)||Q.add(E)}}function B(w,T,C,$){if(uv(w,T,C,$))return;const I=$===!0||typeof $=="object"&&$.capture===!0,R=I?"capture":"bubble",O=b(R,w),U=_(O,T);if(T===window&&!k(T,I?"bubble":"capture",w,C)&&x(w,C)){const G=f[w];G.delete(C),G.size===0&&(window.removeEventListener(w,g),f[w]=void 0)}U.has(C)&&U.delete(C),U.size===0&&O.delete(T),O.size===0&&(window.removeEventListener(w,m,R==="capture"),u[R][w]=void 0)}return{on:v,off:B}}const{on:At,off:ht}=fv(),fr="@@mmoContext",hv={mounted(n,{value:e}){n[fr]={handler:void 0},typeof e=="function"&&(n[fr].handler=e,At("mousemoveoutside",n,e))},updated(n,{value:e}){const i=n[fr];typeof e=="function"?i.handler?i.handler!==e&&(ht("mousemoveoutside",n,i.handler),i.handler=e,At("mousemoveoutside",n,e)):(n[fr].handler=e,At("mousemoveoutside",n,e)):i.handler&&(ht("mousemoveoutside",n,i.handler),i.handler=void 0)},unmounted(n){const{handler:e}=n[fr];e&&ht("mousemoveoutside",n,e),n[fr].handler=void 0}},hr="@@coContext",ts={mounted(n,{value:e,modifiers:i}){n[hr]={handler:void 0},typeof e=="function"&&(n[hr].handler=e,At("clickoutside",n,e,{capture:i.capture}))},updated(n,{value:e,modifiers:i}){const r=n[hr];typeof e=="function"?r.handler?r.handler!==e&&(ht("clickoutside",n,r.handler,{capture:i.capture}),r.handler=e,At("clickoutside",n,e,{capture:i.capture})):(n[hr].handler=e,At("clickoutside",n,e,{capture:i.capture})):r.handler&&(ht("clickoutside",n,r.handler,{capture:i.capture}),r.handler=void 0)},unmounted(n,{modifiers:e}){const{handler:i}=n[hr];i&&ht("clickoutside",n,i,{capture:e.capture}),n[hr].handler=void 0}};function mv(n,e){console.error(`[vdirs/${n}]: ${e}`)}class pv{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(e,i){const{elementZIndex:r}=this;if(i!==void 0){e.style.zIndex=`${i}`,r.delete(e);return}const{nextZIndex:o}=this;r.has(e)&&r.get(e)+1===this.nextZIndex||(e.style.zIndex=`${o}`,r.set(e,o),this.nextZIndex=o+1,this.squashState())}unregister(e,i){const{elementZIndex:r}=this;r.has(e)?r.delete(e):i===void 0&&mv("z-index-manager/unregister-element","Element not found when unregistering."),this.squashState()}squashState(){const{elementCount:e}=this;e||(this.nextZIndex=2e3),this.nextZIndex-e>2500&&this.rearrange()}rearrange(){const e=Array.from(this.elementZIndex.entries());e.sort((i,r)=>i[1]-r[1]),this.nextZIndex=2e3,e.forEach(i=>{const r=i[0],o=this.nextZIndex++;`${o}`!==r.style.zIndex&&(r.style.zIndex=`${o}`)})}}const Da=new pv,mr="@@ziContext",Ef={mounted(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i;n[mr]={enabled:!!o,initialized:!1},o&&(Da.ensureZIndex(n,r),n[mr].initialized=!0)},updated(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i,s=n[mr].enabled;o&&!s&&(Da.ensureZIndex(n,r),n[mr].initialized=!0),n[mr].enabled=!!o},unmounted(n,e){if(!n[mr].initialized)return;const{value:i={}}=e,{zIndex:r}=i;Da.unregister(n,r)}};function gv(n){const e=t.ref(!!n.value);if(e.value)return t.readonly(e);const i=t.watch(n,r=>{r&&(e.value=!0,i())});return t.readonly(e)}function an(n){const e=t.computed(n),i=t.ref(e.value);return t.watch(e,r=>{i.value=r}),typeof n=="function"?i:{__v_isRef:!0,get value(){return i.value},set value(r){n.set(r)}}}const yv=typeof window<"u";let pr,Hr;(()=>{var n,e;pr=yv?(e=(n=document)===null||n===void 0?void 0:n.fonts)===null||e===void 0?void 0:e.ready:void 0,Hr=!1,pr!==void 0?pr.then(()=>{Hr=!0}):Hr=!0})();function bv(n){if(Hr)return;let e=!1;t.onMounted(()=>{Hr||pr==null||pr.then(()=>{e||n()})}),t.onBeforeUnmount(()=>{e=!0})}function La(n,e){return t.watch(n,i=>{i!==void 0&&(e.value=i)}),t.computed(()=>n.value===void 0?e.value:n.value)}function ns(){const n=t.ref(!1);return t.onMounted(()=>{n.value=!0}),t.readonly(n)}function Rf(n,e){return t.computed(()=>{for(const i of e)if(n[i]!==void 0)return n[i];return n[e[e.length-1]]})}const _v=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function wv(){return _v}function Ha(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);return r()}function Wa(n,e=!0,i=[]){return n.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&i.push(t.createTextVNode(String(r)));return}if(Array.isArray(r)){Wa(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Wa(r.children,e,i)}else r.type!==t.Comment&&i.push(r)}}),i}function Pf(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);const o=Wa(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${n}]: slot[${i}] should have exactly one child.`)}let mi=null;function Ff(){if(mi===null&&(mi=document.getElementById("v-binder-view-measurer"),mi===null)){mi=document.createElement("div"),mi.id="v-binder-view-measurer";const{style:n}=mi;n.position="fixed",n.left="0",n.right="0",n.top="0",n.bottom="0",n.pointerEvents="none",n.visibility="hidden",document.body.appendChild(mi)}return mi.getBoundingClientRect()}function xv(n,e){const i=Ff();return{top:e,left:n,height:0,width:0,right:i.width-n,bottom:i.height-e}}function ja(n){const e=n.getBoundingClientRect(),i=Ff();return{left:e.left-i.left,top:e.top-i.top,bottom:i.height+i.top-e.bottom,right:i.width+i.left-e.right,width:e.width,height:e.height}}function kv(n){return n.nodeType===9?null:n.parentNode}function Vf(n){if(n===null)return null;const e=kv(n);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:i,overflowX:r,overflowY:o}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(i+o+r))return e}return Vf(e)}const Mf=t.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(n){var e;t.provide("VBinder",(e=t.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const i=t.inject("VBinder",null),r=t.ref(null),o=y=>{r.value=y,i&&n.syncTargetWithParent&&i.setTargetRef(y)};let s=[];const a=()=>{let y=r.value;for(;y=Vf(y),y!==null;)s.push(y);for(const _ of s)At("scroll",_,f,!0)},l=()=>{for(const y of s)ht("scroll",y,f,!0);s=[]},c=new Set,d=y=>{c.size===0&&a(),c.has(y)||c.add(y)},u=y=>{c.has(y)&&c.delete(y),c.size===0&&l()},f=()=>{_f(h)},h=()=>{c.forEach(y=>y())},p=new Set,m=y=>{p.size===0&&At("resize",window,b),p.has(y)||p.add(y)},g=y=>{p.has(y)&&p.delete(y),p.size===0&&ht("resize",window,b)},b=()=>{p.forEach(y=>y())};return t.onBeforeUnmount(()=>{ht("resize",window,b),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:g}},render(){return Ha("binder",this.$slots)}}),If=t.defineComponent({name:"Target",setup(){const{setTargetRef:n,syncTarget:e}=t.inject("VBinder");return{syncTarget:e,setTargetDirective:{mounted:n,updated:n}}},render(){const{syncTarget:n,setTargetDirective:e}=this;return n?t.withDirectives(Pf("follower",this.$slots),[[e]]):Pf("follower",this.$slots)}}),Cv="@css-render/vue3-ssr";function vv(n,e){return`<style cssr-id="${n}">
|
|
103
|
+
`}},Po=vi.Multiply,F0=[1,0,0,0,1,0,0,0,1],ui=new Cn(9),V0=St.Utils,Fd=new re,ua=new Cn([0,0,1,0,0,1,0,1,1,0,1,1]),Se={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Ke.document?Ke.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new vi,group:{removeChild:function(n,e){if(n.children)for(let i=0;i<n.children.length;i++)Se.group.removeChild(n.children[i],e);n._renderer.texture&&(e.deleteTexture(n._renderer.texture),delete n._renderer.texture),n._renderer.positionBuffer&&(e.deleteBuffer(n._renderer.positionBuffer),delete n._renderer.positionBuffer)},render:function(n,e){if(!this._visible)return;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.parent,r=i._matrix&&i._matrix.manual||i._flagMatrix,o=this._matrix.manual||this._flagMatrix;if((r||o)&&(this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,i._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(i._renderer.type)||(this._renderer.scale.x*=i._renderer.scale.x,this._renderer.scale.y*=i._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const a=St.Utils.getRendererType(this._mask._renderer.type);Se[a].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}this._flagOpacity=i._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);let s;if(this._flagSubtractions)for(s=0;s<this.subtractions.length;s++)Se.group.removeChild(this.subtractions[s],n);for(s=0;s<this.children.length;s++){const a=this.children[s],l=St.Utils.getRendererType(a._renderer.type);Se[l].render.call(a,n,e)}return this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(n,e){let i,r,o,s,a,l,c,d,u,f,h,p,m,g;const b=e._renderer.vertices,y=this.canvas,_=this.ctx,k=n.renderer.ratio,x=Fd.copy(e._renderer.scale).multiply(k),v=e._stroke,B=e._linewidth,w=e._fill,T=e._renderer.opacity||e._opacity,C=e._cap,$=e._join,E=e._miter,I=e._closed,R=e.dashes,O=b.length,U=O-1;y.width=Math.max(Math.ceil(e._renderer.rect.width*x.x),1),y.height=Math.max(Math.ceil(e._renderer.rect.height*x.y),1);const Q=e._renderer.rect.centroid,G=Q.x,W=Q.y;if(_.clearRect(0,0,y.width,y.height),w)if(typeof w=="string")_.fillStyle=w;else{const V=St.Utils.getRendererType(w._renderer.type);Se[V].render.call(w,_,e),_.fillStyle=w._renderer.effect}if(v){if(typeof v=="string")_.strokeStyle=v;else{const V=St.Utils.getRendererType(v._renderer.type);Se[V].render.call(v,_,e),_.strokeStyle=v._renderer.effect}B&&(_.lineWidth=vn(e)),E&&(_.miterLimit=E),$&&(_.lineJoin=$),!I&&C&&(_.lineCap=C)}typeof T=="number"&&(_.globalAlpha=T),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let D,L,z,P,q,K,J,Y;_.save(),_.scale(x.x,x.y),_.translate(G,W),_.beginPath();for(let V=0;V<b.length;V++){const A=b[V];switch(p=A.x,m=A.y,A.command){case ne.close:_.closePath();break;case ne.arc:L=A.rx,z=A.ry,P=A.xAxisRotation,q=A.largeArcFlag,K=A.sweepFlag,i=I?st(V-1,O):Math.max(V-1,0),r=b[i],J=r.x,Y=r.y,V0.renderSvgArcCommand(_,J,Y,L,z,q,K,P,p,m);break;case ne.curve:i=I?st(V-1,O):Math.max(V-1,0),r=b[i],d=r.controls&&r.controls.right||re.zero,u=A.controls&&A.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),A._relative?(s=u.x+A.x,a=u.y+A.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,p,m),V>=U&&I&&(o=D,f=A.controls&&A.controls.right||re.zero,h=o.controls&&o.controls.left||re.zero,A._relative?(l=f.x+A.x,c=f.y+A.y):(l=f.x,c=f.y),o._relative?(s=h.x+o.x,a=h.y+o.y):(s=h.x,a=h.y),p=o.x,m=o.y,_.bezierCurveTo(l,c,s,a,p,m));break;case ne.line:_.lineTo(p,m);break;case ne.move:D=A,_.moveTo(p,m);break}}I&&_.closePath(),Se.isHidden.test(w)||(g=w._renderer&&w._renderer.offset,g&&(_.save(),_.translate(-w._renderer.offset.x,-w._renderer.offset.y),_.scale(w._renderer.scale.x,w._renderer.scale.y)),_.fill(),g&&_.restore()),Se.isHidden.test(v)||(g=v._renderer&&v._renderer.offset,g&&(_.save(),_.translate(-v._renderer.offset.x,-v._renderer.offset.y),_.scale(v._renderer.scale.x,v._renderer.scale.y),_.lineWidth=B/v._renderer.scale.x),_.stroke(),g&&_.restore()),_.restore()},getBoundingClientRect:function(n,e,i){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;n.forEach(function(d){const u=d.x,f=d.y,h=d.controls;let p,m,g,b,y,_;s=Math.min(f,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(f,a),d.controls&&(y=h.left,_=h.right,!(!y||!_)&&(p=d._relative?y.x+u:y.x,m=d._relative?y.y+f:y.y,g=d._relative?_.x+u:_.x,b=d._relative?_.y+f:_.y,!(!p||!m||!g||!b)&&(s=Math.min(m,b,s),r=Math.min(p,g,r),o=Math.max(p,g,o),a=Math.max(m,b,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,i.top=s,i.left=r,i.right=o,i.bottom=a,i.width=l,i.height=c,i.centroid||(i.centroid={}),i.centroid.x=-r,i.centroid.y=-s},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=St.Utils.getRendererType(this._renderer.type),s=e[o],a=r._matrix.manual||r._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._flagVertices||this._flagFill||this._fill instanceof Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let f,h;this._scale instanceof re?(f=this._scale.x*r._renderer.scale.x,h=this._scale.y*r._renderer.scale.y):(f=this._scale*r._renderer.scale.x,h=this._scale*r._renderer.scale.y),this._renderer.scale.x=f<0?-f:f,this._renderer.scale.y=h<0?-h:h,c&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const f=St.Utils.getRendererType(this._mask._renderer.type);Se[f].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==s&&(n.useProgram(s),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,ua,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(n,e){let i;const r=this.canvas,o=this.ctx,s=n.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._size*s;let h=f;Se.isHidden.test(a)||(h+=l),r.width=_c(h),r.height=r.width;const p=h/r.width,m=r.width/2,g=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const b=St.Utils.getRendererType(c._renderer.type);Se[b].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const b=St.Utils.getRendererType(a._renderer.type);Se[b].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=vn(e)/p)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(m,g),o.scale(Se.precision,Se.precision),o.beginPath(),o.arc(0,0,f/p*.5,0,tt),o.restore(),closed&&o.closePath(),Se.isHidden.test(c)||(i=c._renderer&&c._renderer.offset,i&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),i&&o.restore()),Se.isHidden.test(a)||(i=a._renderer&&a._renderer.offset,i&&(o.save(),o.translate(-a._renderer.offset.x,-a._renderer.offset.y),o.scale(a._renderer.scale.x,a._renderer.scale.y),o.lineWidth=l/a._renderer.scale.x),o.stroke(),i&&o.restore())},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=i||this.parent,s=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=o._matrix.manual||o._flagMatrix,u=this._matrix.manual||this._flagMatrix,f=this._renderer.parent!==o,h=this._renderer.vertices,p=this._renderer.collection.length,m=this._flagVertices,g=this._flagFill||this._fill instanceof Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||o._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||u||f){this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let b,y;this._scale instanceof re?(b=this._scale.x*o._renderer.scale.x,y=this._scale.y*o._renderer.scale.y):(b=this._scale*o._renderer.scale.x,y=this._scale*o._renderer.scale.y),this._renderer.scale.x=b<0?-b:b,this._renderer.scale.y=y<0?-y:y,f&&(this._renderer.parent=o)}if(m){const b=this._renderer.positionBuffer;b&&n.deleteBuffer(b),this._renderer.positionBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this._renderer.positionBuffer),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,h,n.STATIC_DRAW)}return g?(this._renderer.opacity=this._opacity*o._renderer.opacity,Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture?this:(Se.isHidden.test(l)||(r+=c),r/=Se.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(n.useProgram(s),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture),n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform1f(s.size,r*e.resolution.ratio),n.drawArrays(n.POINTS,0,p),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(n,e){const i=this.canvas,r=this.ctx,o=n.renderer.ratio,s=Fd.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._decoration,h=e._direction;i.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),i.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const p=e._renderer.rect.centroid,m=p.x,g=p.y;let b,y,_,k,x,v,B,w,T,C,$;const E=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,i.width,i.height),E||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=h,c)if(typeof c=="string")r.fillStyle=c;else{const I=St.Utils.getRendererType(c._renderer.type);Se[I].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const I=St.Utils.getRendererType(a._renderer.type);Se[I].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=vn(e))}if(typeof d=="number"&&(r.globalAlpha=d),u&&u.length>0&&(r.lineDashOffset=u.offset||0,r.setLineDash(u)),r.save(),r.scale(s.x,s.y),r.translate(m,g),Se.isHidden.test(c)||(c._renderer&&c._renderer.offset?(v=c._renderer.scale.x,B=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(v,B),b=e._size/c._renderer.scale.y,y=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,k=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,k),r.restore()):r.fillText(e.value,0,0)),Se.isHidden.test(a)||(a._renderer&&a._renderer.offset?(v=a._renderer.scale.x,B=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(v,B),b=e._size/a._renderer.scale.y,y=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,k=a._renderer.offset.y/a._renderer.scale.y,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(e.value,_,k),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(f)){const I=r.measureText(e.value);switch(f){case"underline":T=I.actualBoundingBoxDescent,$=I.actualBoundingBoxDescent;break;case"strikethrough":T=0,$=0;break}w=-I.width/2,C=I.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(w,T),r.lineTo(C,$),r.stroke()}r.restore()},getBoundingClientRect:function(n,e){const i=Se.ctx;i.font=[n._style,n._weight,n._size+"px/"+n._leading+"px",n._family].join(" "),i.textAlign="center",i.textBaseline=St.Utils.baselines[n._baseline]||n._baseline;const r=i.measureText(n._value);let o=r.width,s=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!Se.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(Se.alignments[n._alignment]||n._alignment){case Se.alignments.left:n.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case Se.alignments.right:n.direction==="ltr"?(e.left=-o,e.right=0):(e.left=0,e.right=o);break;default:e.left=-a,e.right=a}switch(n._baseline){case"bottom":e.top=-s,e.bottom=0;break;case"top":e.top=0,e.bottom=s;break;case"baseline":e.top=-l*1.5,e.bottom=l*.5;break;default:e.top=-l,e.bottom=l}e.width=o,e.height=s,e.centroid||(e.centroid={}),e.centroid.x=a,e.centroid.y=l},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=e[this._renderer.type],s=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(s||a||l){this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let u,f;this._scale instanceof re?(u=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=f<0?-f:f,l&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const u=St.Utils.getRendererType(this._mask._renderer.type);Se[u].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.text.getBoundingClientRect(this,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==o&&(n.useProgram(o),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(o.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(o.position),n.bufferData(n.ARRAY_BUFFER,ua,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return n.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),n.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=n.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,a=(a-.5)*i.height*.5,l*=Math.min(i.width,i.height)),this._renderer.effect=n.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n,e){if(!n.canvas.getContext("2d"))return;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=n.createPattern(i,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,i&&(this._renderer.offset.x+=i.width/2,this._renderer.offset.y+=i.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),this._flagScale||this._flagLoaded){this._renderer.scale instanceof re||(this._renderer.scale=new re);let r,o;this._scale instanceof re?(r=this._scale.x,o=this._scale.y):(r=this._scale,o=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=o<0?-o:o}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(n,e){const i=St.Utils.getRendererType(e._renderer.type);if(this[i].updateCanvas.call(Se,n,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&n.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=n.createTexture()),n.bindTexture(n.TEXTURE_2D,e._renderer.texture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,this.canvas),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR)},program:{create:function(n,e){let i,r,o;if(i=n.createProgram(),oe.each(e,function(s){n.attachShader(i,s)}),n.linkProgram(i),r=n.getProgramParameter(i,n.LINK_STATUS),!r)throw o=n.getProgramInfoLog(i),n.deleteProgram(i),new Ht("unable to link program: "+o);return i}},extensions:{init:function(n){const e={},i=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<i.length;r++){const o=i[r];e[o]=Se.extensions.get(n,o)}return e},get:function(n,e){return n.getExtension(e)||n.getExtension(`MOZ_${e}`)||n.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new ho};Se.ctx=Se.canvas.getContext("2d");var Vd=class extends ee{constructor(n){super();let e,i,r,o;if(this.domElement=n.domElement||document.createElement("canvas"),typeof n.offscreenElement<"u"&&(Se.canvas=n.offscreenElement,Se.ctx=Se.canvas.getContext("2d")),this.scene=new yt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new Cn(F0),scale:1,opacity:1},this._flagMatrix=!0,n=oe.defaults(n||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=n.overdraw,e=this.ctx=this.domElement.getContext("webgl",n)||this.domElement.getContext("experimental-webgl",n),!this.ctx)throw new Ht("unable to create a webgl context. Try using another renderer.");r=sn.create(e,sn.path.vertex,sn.types.vertex),o=sn.create(e,sn.path.fragment,sn.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},i=this.programs.path=Se.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=Se.extensions.init(e),e.renderer=this,i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.rect=e.getUniformLocation(i,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(i.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(i.position),e.bufferData(e.ARRAY_BUFFER,ua,e.STATIC_DRAW),r=sn.create(e,sn.points.vertex,sn.types.vertex),o=sn.create(e,sn.points.fragment,sn.types.fragment),i=this.programs.points=Se.program.create(e,[r,o]),i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.size=e.getUniformLocation(i,"u_size"),e.enable(e.BLEND),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}setSize(n,e,i){let r,o;const s=this.ctx;return this.width=n,this.height=e,this.ratio=typeof i>"u"?zs(s):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,oe.isObject(this.domElement.style)&&oe.extend(this.domElement.style,{width:n+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=n*this.ratio,o=e*this.ratio,s.viewport(0,0,r,o),this.programs.resolution.width=r,this.programs.resolution.height=o,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(ee.Types.resize,n,e,i)}render(){const n=this.ctx;return this.overdraw||n.clear(n.COLOR_BUFFER_BIT),Se.group.render.call(this.scene,n,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};S(Vd,"Utils",Se);var M0=oe.extend({Error:Ht,getRatio:zs,read:Ue,xhr:Nd},oe,Ft,pc,gc),Te=class ro{constructor(e){S(this,"_events",new ee),S(this,"type",""),S(this,"renderer",null),S(this,"scene",null),S(this,"width",0),S(this,"height",0),S(this,"frameCount",0),S(this,"timeDelta",0),S(this,"playing",!1);const i=oe.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:ro.Types.svg,autostart:!1});if(oe.each(i,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),oe.isElement(i.domElement)){const r=i.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=ro.Types[r])}this.renderer=new ro[this.type](this),this.setPlaying(i.autostart),this.frameCount=0,i.fullscreen?(this.fit=I0.bind(this),this.fit.domElement=window,this.fit.attached=!0,oe.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),oe.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Gt.bind(this.fit.domElement,"resize",this.fit),this.fit()):i.fitted?(this.fit=A0.bind(this),oe.extend(this.renderer.domElement.style,{display:"block"})):typeof i.width=="number"&&typeof i.height=="number"&&(this.renderer.setSize(i.width,i.height,this.ratio),this.width=i.width,this.height=i.height),this.renderer.bind(ee.Types.resize,O0.bind(this)),this.scene=this.renderer.scene,ro.Instances.push(this),i.autostart&&Fr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=this._events.listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=this._events.ignore)==null?void 0:e.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,Fr.init(),this.trigger(ee.Types.play)}pause(){return this.playing=!1,this.trigger(ee.Types.pause)}setPlaying(e){this.playing=e}release(e){let i,r,o;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&typeof e.fill.unbind=="function"&&e.fill.unbind(),typeof e.stroke=="object"&&typeof e.stroke.unbind=="function"&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(i=0;i<e.vertices.length;i++)r=e.vertices[i],typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}if(e.children){for(i=0;i<e.children.length;i++)o=e.children[i],this.release(o);if(typeof e.children.unbind=="function")try{e.children.unbind()}catch{}}if(e._renderer){if(e._renderer.elem&&e._renderer.elem.parentNode&&(e._renderer.elem.parentNode.removeChild(e._renderer.elem),delete e._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const s=this.renderer.ctx;e._renderer.texture&&(s.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(s.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer),e._renderer.effect&&(e._renderer.effect=null)}this.type==="CanvasRenderer"&&e._renderer.context&&delete e._renderer.context}return e}getShapesAtPoint(e,i,r){return this.scene&&typeof this.scene.getShapesAtPoint=="function"?this.scene.getShapesAtPoint(e,i,r):[]}update(){const e=!!this._lastFrame,i=oe.performance.now();e&&(this.timeDelta=parseFloat((i-this._lastFrame).toFixed(3))),this._lastFrame=i,this.fit&&this.fit.domElement&&!this.fit.attached&&(Gt.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,o=this.height,s=this.renderer;return(r!==s.width||o!==s.height)&&s.setSize(r,o,this.ratio),this.trigger(ee.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(ee.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,i,r,o){const s=new No(e,i,r,o);return this.scene.add(s),s}makeArrow(e,i,r,o,s){const a=typeof s=="number"?s:10,l=Math.atan2(o-i,r-e),c=[new Ee(e,i,void 0,void 0,void 0,void 0,ne.move),new Ee(r,o,void 0,void 0,void 0,void 0,ne.line),new Ee(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,ne.line),new Ee(r,o,void 0,void 0,void 0,void 0,ne.move),new Ee(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,ne.line)],d=new Pe(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,i,r,o){const s=new di(e,i,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,i,r,o,s){const a=new vo(e,i,r,o,s);return this.scene.add(a),a}makeCircle(e,i,r,o){const s=new ko(e,i,r,o);return this.scene.add(s),s}makeEllipse(e,i,r,o,s){const a=new Co(e,i,r,o,s);return this.scene.add(a),a}makeStar(e,i,r,o,s){const a=new na(e,i,r,o,s);return this.scene.add(a),a}makeCurve(e){const i=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<i;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new Ee(l,c))}}const r=arguments[i-1],o=new Pe(e,!(typeof r=="boolean"&&r),!0),s=o.getBoundingClientRect();return o.center().translation.set(s.left+s.width/2,s.top+s.height/2),this.scene.add(o),o}makePolygon(e,i,r,o){const s=new ta(e,i,r,o);return this.scene.add(s),s}makeArcSegment(e,i,r,o,s,a,l){const c=new Ks(e,i,r,o,s,a,l);return this.scene.add(c),c}makePoints(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let s=0;s<i;s+=2){const a=arguments[s];if(typeof a!="number")break;const l=arguments[s+1];r.push(new re(a,l))}}const o=new ea(r);return this.scene.add(o),o}makePath(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<i;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Ee(c,d))}}const o=arguments[i-1],s=new Pe(r,!(typeof o=="boolean"&&o)),a=s.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&s.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(s),s}makeText(e,i,r,o){const s=new Sn(e,i,r,o);return this.add(s),s}makeLinearGradient(e,i,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ge(e,i,r,o,s);return this.add(a),a}makeRadialGradient(e,i,r){const o=Array.prototype.slice.call(arguments,3),s=new Ze(e,i,r,o);return this.add(s),s}makeSprite(e,i,r,o,s,a,l){const c=new xo(e,i,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,i,r,o,s,a){const l=new Td(e,i,r,o,s,a);return this.add(l),l}makeImageSequence(e,i,r,o,s){const a=new sa(e,i,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,i){return new ze(e,i)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const i=new yt;return this.scene.add(i),i.add(e),i}interpret(e,i,r){const o=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(o in Ue))return null;const s=Ue[o].call(this,e);return r?this.add(i&&s instanceof yt?s.children:s):s.parent&&s.remove(),s}load(e,i){const r=new yt;let o,s,a;const l=(function(c){for(Gt.temp.innerHTML=c,s=0;s<Gt.temp.children.length;s++)o=Gt.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof i=="function"){const d=Gt.temp.children.length<=1?Gt.temp.children[0]:Gt.temp.children;i(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Nd(e,l),r):(l(e),r)}};S(Te,"NextFrameId",Ct.NextFrameId),S(Te,"Types",Ct.Types),S(Te,"Version",Ct.Version),S(Te,"PublishDate",Ct.PublishDate),S(Te,"Identifier",Ct.Identifier),S(Te,"Resolution",Ct.Resolution),S(Te,"AutoCalculateImportedMatrices",Ct.AutoCalculateImportedMatrices),S(Te,"Instances",Ct.Instances),S(Te,"uniqueId",Ct.uniqueId),S(Te,"Anchor",Ee),S(Te,"Collection",li),S(Te,"Events",ee),S(Te,"Group",yt),S(Te,"Matrix",vi),S(Te,"Path",Pe),S(Te,"Registry",ho),S(Te,"Element",er),S(Te,"Shape",Hn),S(Te,"Text",Sn),S(Te,"Vector",re),S(Te,"Gradient",ut),S(Te,"Image",Td),S(Te,"ImageSequence",sa),S(Te,"LinearGradient",Ge),S(Te,"RadialGradient",Ze),S(Te,"Sprite",xo),S(Te,"Stop",ci),S(Te,"Texture",ze),S(Te,"ArcSegment",Ks),S(Te,"Circle",ko),S(Te,"Ellipse",Co),S(Te,"Line",No),S(Te,"Points",ea),S(Te,"Polygon",ta),S(Te,"Rectangle",di),S(Te,"RoundedRectangle",vo),S(Te,"Star",na),S(Te,"CanvasRenderer",St),S(Te,"SVGRenderer",Pd),S(Te,"WebGLRenderer",Vd),S(Te,"Commands",ne),S(Te,"Utils",M0);var Nn=Te;function I0(){const n=document.body.getBoundingClientRect(),e=this.width=n.width,i=this.height=n.height;this.renderer.setSize(e,i,this.ratio)}function A0(){const n=this.renderer.domElement.parentElement;if(!n){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const e=n.getBoundingClientRect(),i=this.width=e.width,r=this.height=e.height;this.renderer.setSize(i,r,this.ratio)}function O0(n,e){this.width=n,this.height=e,this.trigger(ee.Types.resize,n,e)}var Fr=Gt.getRequestAnimationFrame();function Md(){for(let n=0;n<Nn.Instances.length;n++){const e=Nn.Instances[n];e.playing&&e.update()}Nn.NextFrameId=Fr(Md)}Fr.init=function(){Md(),Fr.init=function(){}};let Tn;typeof window<"u"?Tn=window:typeof global<"u"?Tn=global:typeof self<"u"&&(Tn=self);let Id;const Zt=Math.PI*2,bt=Math.PI*.5;function z0(n,e,i,r,o,s){let a;return arguments.length<=1?(a=n.a,e=n.b,i=n.c,r=n.d,o=n.e,s=n.f):a=n,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function D0(n){Id=n}function L0(n,e){e=e&&e.identity()||new Id;let i=n;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function jt(n,e,i){return i*(e-n)+n}function qt(n,e){for(;n<0;)n+=e;return n%e}const Ad=Tn.Float32Array||Array,H0=Math.floor;function $n(n){return H0(n*1e6)/1e6}const fe={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};class te{constructor(){N(this,"_events",{});N(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(i)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,i!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}}N(te,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),N(te,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Od={x:{enumerable:!0,get:function(){return this._x},set:function(n){this._x!==n&&(this._x=n,this._bound&&this.dispatchEvent(te.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(n){this._y!==n&&(this._y=n,this._bound&&this.dispatchEvent(te.Types.change))}}},wt=class wt extends te{constructor(i=0,r=0){super();N(this,"_x",0);N(this,"_y",0);for(let o in Od)Object.defineProperty(this,o,Od[o]);this.x=i,this.y=r}static add(i,r){return new wt(i.x+r.x,i.y+r.y)}static sub(i,r){return new wt(i.x-r.x,i.y-r.y)}static subtract(i,r){return wt.sub(i,r)}static ratioBetween(i,r){return(i.x*r.x+i.y*r.y)/(i.length()*r.length())}static angleBetween(i,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const o=i.x-r.x,s=i.y-r.y;return Math.atan2(s,o)}static distanceBetween(i,r){return Math.sqrt(wt.distanceBetweenSquared(i,r))}static distanceBetweenSquared(i,r){const o=i.x-r.x,s=i.y-r.y;return o*o+s*s}set(i,r){return this.x=i,this.y=r,this}copy(i){return this.x=i.x,this.y=i.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new wt(this.x,this.y)}add(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x+=i,this.y+=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x+=i.x,this.y+=i.y):(this.x+=i,this.y+=r),this)}addSelf(i){return this.add.apply(this,arguments)}sub(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x-=i,this.y-=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x-=i.x,this.y-=i.y):(this.x-=i,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(i){return this.sub.apply(this,arguments)}subtractSelf(i){return this.sub.apply(this,arguments)}multiply(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x*=i,this.y*=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x*=i.x,this.y*=i.y):(this.x*=i,this.y*=r),this)}multiplySelf(i){return this.multiply.apply(this,arguments)}multiplyScalar(i){return this.multiply(i)}divide(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x/=i,this.y/=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x/=i.x,this.y/=i.y):(this.x/=i,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(i){return this.divide.apply(this,arguments)}divideScalar(i){return this.divide(i)}negate(){return this.multiply(-1)}dot(i){return this.x*i.x+this.y*i.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(i){return Math.sqrt(this.distanceToSquared(i))}distanceToSquared(i){const r=this.x-i.x,o=this.y-i.y;return r*r+o*o}setLength(i){return this.normalize().multiplyScalar(i)}equals(i,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(i)<r}lerp(i,r){const o=(i.x-this.x)*r+this.x,s=(i.y-this.y)*r+this.y;return this.set(o,s)}isZero(i){return i=typeof i>"u"?1e-4:i,this.length()<i}toString(){return this.x+", "+this.y}toObject(){return{x:$n(this.x),y:$n(this.y)}}rotate(i){const r=this.x,o=this.y,s=Math.cos(i),a=Math.sin(i);return this.x=r*s-o*a,this.y=r*a+o*s,this}};N(wt,"zero",new wt),N(wt,"left",new wt(-1,0)),N(wt,"right",new wt(1,0)),N(wt,"up",new wt(0,-1)),N(wt,"down",new wt(0,1));let ge=wt;class Ie extends ge{constructor(i=0,r=0,o=0,s=0,a=0,l=0,c=fe.move){super(i,r);N(this,"controls",{left:new ge,right:new ge});N(this,"_command",fe.move);N(this,"_relative",!0);N(this,"_rx",0);N(this,"_ry",0);N(this,"_xAxisRotation",0);N(this,"_largeArcFlag",0);N(this,"_sweepFlag",1);for(let u in zd)Object.defineProperty(this,u,zd[u]);this.command=c,this.relative=!0;const d=Ie.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(te.Types.change,d),this.controls.right.set(a,l).addEventListener(te.Types.change,d)}static makeBroadcast(i){return r;function r(){i._bound&&i.dispatchEvent(te.Types.change)}}static fromObject(i){return new Ie().copy(i)}copy(i){return this.x=i.x,this.y=i.y,typeof i.command=="string"&&(this.command=i.command),i.controls&&(i.controls.left&&this.controls.left.copy(i.controls.left),i.controls.right&&this.controls.right.copy(i.controls.right)),typeof i.relative=="boolean"&&(this.relative=i.relative),typeof i.rx=="number"&&(this.rx=i.rx),typeof i.ry=="number"&&(this.ry=i.ry),typeof i.xAxisRotation=="number"&&(this.xAxisRotation=i.xAxisRotation),typeof i.largeArcFlag=="number"&&(this.largeArcFlag=i.largeArcFlag),typeof i.sweepFlag=="number"&&(this.sweepFlag=i.sweepFlag),this}clone(){return new Ie().copy(this)}toObject(){return{x:$n(this.x),y:$n(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:$n(this.rx),ry:$n(this.ry),xAxisRotation:$n(this.xAxisRotation),largeArcFlag:$n(this.largeArcFlag),sweepFlag:$n(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const zd={command:{enumerable:!0,get:function(){return this._command},set:function(n){this._command!==n&&(this._command=n,this._bound&&this.dispatchEvent(te.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(n){this._relative!==!!n&&(this._relative=!!n,this._bound&&this.dispatchEvent(te.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(n){this._rx!==n&&(this._rx=n,this._bound&&this.dispatchEvent(te.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(n){this._ry!==n&&(this._ry=n,this._bound&&this.dispatchEvent(te.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(n){this._xAxisRotation!==n&&(this._xAxisRotation=n,this._bound&&this.dispatchEvent(te.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(n){this._largeArcFlag!==n&&(this._largeArcFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(n){this._sweepFlag!==n&&(this._sweepFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}}};let W0=0;const Fo={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return W0++}},Vo={RecursionLimit:16,abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Mo(n,e,i,r,o){const s=1-n;return s*s*s*e+3*s*s*n*i+3*s*n*n*r+n*n*n*o}function Dd(n,e,i,r,o,s,a,l,c){c=c||Vo.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ie(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Mo(h,n,i,o,a),m=Mo(h,e,r,s,l);u.push(new Ie(p,m))}return u}function j0(n,e,i,r,o,s,a,l,c){if(n===i&&e===r&&o===a&&s===l){const b=a-n,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(a-n),u=6*(n+o)-12*i,f=3*(i-n),h=9*(r-s)+3*(l-e),p=6*(e+s)-12*r,m=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+p)*b+m;return Math.sqrt(y*y+_*_)}return X0(g,0,1,c||Vo.RecursionLimit)}function q0(n,e,i,r,o,s,a,l){const c=[],d=[[],[]];let u,f,h,p,m,g,b,y;for(let v=0;v<2;++v){if(v===0?(f=6*n-12*i+6*o,u=-3*n+9*i-9*o+3*a,h=3*i-3*n):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;p=-h/f,0<p&&p<1&&c.push(p);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(m=(-f+y)/(2*u),0<m&&m<1&&c.push(m),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)p=c[_],x=1-p,d[0][_]=x*x*x*n+3*x*x*p*i+3*x*p*p*o+p*p*p*a,d[1][_]=x*x*x*e+3*x*x*p*r+3*x*p*p*s+p*p*p*l;return d[0][k]=n,d[1][k]=e,d[0][k+1]=a,d[1][k+1]=l,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function X0(n,e,i,r){let o=Vo.abscissas[r-2],s=Vo.weights[r-2],a=.5*(i-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*n(l):0;for(;c<d;){const f=a*o[c];u+=s[c++]*(n(l+f)+n(l-f))}return a*u}function Y0(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?qt(o-1,i):Math.max(o-1,0),l=e?qt(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];U0(c,d,u),d.command=o===0?fe.move:fe.curve}}function U0(n,e,i){const r=ge.angleBetween(n,e),o=ge.angleBetween(i,e);let s=ge.distanceBetween(n,e),a=ge.distanceBetween(i,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=bt:l-=bt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}let Vr=(Li=class extends te{constructor(){super();N(this,"_flagId",!1);N(this,"_flagClassName",!1);N(this,"_renderer",{});N(this,"_id",Fo.Identifier+Fo.uniqueId());N(this,"_className","");N(this,"classList",[]);for(let i in Ld)Object.defineProperty(this,i,Ld[i])}static fromObject(i){const r=new Li().copy(i);return"id"in i&&(r.id=i.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(i){return i.renderer&&typeof i.renderer.type=="string"&&(this.renderer.type=i.renderer.type),typeof i.className=="string"&&(this.className=i.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const r=this.renderer.ctx;this._renderer.texture&&(r.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(r.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const i=this._renderer.type;return this._renderer={type:i},this}},N(Li,"Properties",["renderer","id","className"]),Li);const Ld={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(n){const e=this._id;n!==this._id&&(this._id=n,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(n){this._className!==n&&(this._flagClassName=!0,this.classList=n.split(/\s+?/),this._className=n)}}};class Io extends Error{constructor(i){super();N(this,"name","Two.js");N(this,"message");this.message=i}}class K0{constructor(){N(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let Ao;const Hd={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Tn.document&&(Ao=document.createElement("a"));const Je=class Je extends Vr{constructor(i,r){super();N(this,"_flagSrc",!1);N(this,"_flagImage",!1);N(this,"_flagVideo",!1);N(this,"_flagLoaded",!1);N(this,"_flagRepeat",!1);N(this,"_flagOffset",!1);N(this,"_flagScale",!1);N(this,"_src","");N(this,"_image",null);N(this,"_loaded",!1);N(this,"_repeat","no-repeat");N(this,"_scale",1);N(this,"_offset",null);for(let o in Wd)Object.defineProperty(this,o,Wd[o]);if(this._renderer.type="texture",this._renderer.flagOffset=G0.bind(this),this._renderer.flagScale=Z0.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new ge,typeof r=="function"){const o=(function(){this.unbind(te.Types.load,o),typeof r=="function"&&r()}).bind(this);this.bind(te.Types.load,o)}if(typeof i=="string")this.src=i;else if(typeof i=="object"){const o=Object.prototype.toString.call(i);(o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"||o==="[object HTMLVideoElement]"||o==="[object Image]")&&(this.image=i)}this._update()}fromObject(i){const r=new Je().copy(i);return"id"in i&&(r.id=i.id),r}static getAbsoluteURL(i){return Ao?(Ao.href=i,Ao.href):i}static loadHeadlessBuffer(i,r){i.image.onload=r,i.image.src=i.src}static getTag(i){return i&&i.nodeName&&i.nodeName.toLowerCase()||"img"}static getImage(i){const r=Je.getAbsoluteURL(i);if(Je.ImageRegistry.contains(r))return Je.ImageRegistry.get(r);let o;return Tn.document?Hd.video.test(r)?o=document.createElement("video"):o=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),o.crossOrigin="anonymous",o.referrerPolicy="no-referrer",o}static load(i,r){let o=i.image,s=Je.getTag(o);i._flagImage&&(/canvas/i.test(s)?Je.Register.canvas(i,r):(i._src=o.getAttribute("two-src")||o.src,Je.Register[s](i,r))),i._flagSrc&&(o||(o=Je.getImage(i.src),i.image=o),s=Je.getTag(o),Je.Register[s](i,r))}clone(){const i=new Je(this.src);return i.repeat=this.repeat,i.offset.copy(this.offset),i.scale=this.scale,i}copy(i){return this.src=i.src,this.repeat=i.repeat,this.offset=typeof i.offset=="number"||i.offset instanceof ge?i.offset:new ge().copy(i.offset),this.scale=typeof i.scale=="number"||i.scale instanceof ge?i.scale:new ge().copy(i.scale),this}toObject(){const i=super.toObject.call(this);return i.renderer.type="texture",i.src=this.src,i.repeat=this.repeat,i.offset=this.offset.toObject(),i.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),i}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(te.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Je.load(this,(function(){this.loaded=!0,this.trigger(te.Types.change).trigger(te.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};N(Je,"Properties",["src","loaded","repeat","scale","offset","image"]),N(Je,"RegularExpressions",Hd),N(Je,"ImageRegistry",new K0),N(Je,"Register",{canvas:function(i,r){i._src="#"+i.id,Je.ImageRegistry.add(i.src,i.image),typeof r=="function"&&r()},img:function(i,r){const o=i.image,s=function(l){o.removeEventListener&&typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),new Io("unable to load "+i.src)};typeof o.width=="number"&&o.width>0&&typeof o.height=="number"&&o.height>0?s():typeof o.addEventListener=="function"&&(o.addEventListener("load",s,!1),o.addEventListener("error",a,!1)),i._src=Je.getAbsoluteURL(i._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",i.src),Je.ImageRegistry.add(i.src,o),i.image.src=i.src)},video:function(i,r){const o=function(a){i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),i.image.width=i.image.videoWidth,i.image.height=i.image.videoHeight,typeof r=="function"&&r()},s=function(a){throw i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),new Io("unable to load "+i.src)};i._src=Je.getAbsoluteURL(i._src),i.image.getAttribute("two-src")||(i.image.setAttribute("two-src",i.src),Je.ImageRegistry.add(i.src,i.image)),i.image.readyState>=4?o():(i.image.addEventListener("canplaythrough",o,!1),i.image.addEventListener("error",s,!1),i.image.src=i.src,i.image.load())}});let Qe=Je;const Wd={src:{enumerable:!0,get:function(){return this._src},set:function(n){this._src=n,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(n){this._loaded=n,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(n){this._repeat=n,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(n){const e=Qe.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}Qe.ImageRegistry.contains(i)?this._image=Qe.ImageRegistry.get(n.src):this._image=n,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset&&this._offset.unbind(te.Types.change,this._renderer.flagOffset),this._offset=n,this._offset.bind(te.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ge&&this._scale.unbind(te.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof ge&&this._scale.bind(te.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function G0(){this._flagOffset=!0}function Z0(){this._flagScale=!0}class Si extends Array{constructor(){super();Il(this,xt,new te);arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return Dt(this,xt)}set _events(i){Cm(this,xt,i)}get _bound(){return Dt(this,xt)._bound}set _bound(i){Dt(this,xt)._bound=i}addEventListener(){var i;return(i=Dt(this,xt).addEventListener)==null?void 0:i.apply(this,arguments)}on(){var i;return(i=Dt(this,xt).on)==null?void 0:i.apply(this,arguments)}bind(){var i;return(i=Dt(this,xt).bind)==null?void 0:i.apply(this,arguments)}removeEventListener(){var i;return(i=Dt(this,xt).removeEventListener)==null?void 0:i.apply(this,arguments)}off(){var i;return(i=Dt(this,xt).off)==null?void 0:i.apply(this,arguments)}unbind(){var i;return(i=Dt(this,xt).unbind)==null?void 0:i.apply(this,arguments)}dispatchEvent(){var i;return(i=Dt(this,xt).dispatchEvent)==null?void 0:i.apply(this,arguments)}trigger(){var i;return(i=Dt(this,xt).trigger)==null?void 0:i.apply(this,arguments)}listen(){var i;return(i=Dt(this,xt).listen)==null?void 0:i.apply(this,arguments)}ignore(){var i;return(i=Dt(this,xt).ignore)==null?void 0:i.apply(this,arguments)}pop(){const i=super.pop.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}shift(){const i=super.shift.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}push(){const i=super.push.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}unshift(){const i=super.unshift.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}splice(){const i=super.splice.apply(this,arguments);if(this.trigger(te.Types.remove,i),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(te.Types.insert,r),this.trigger(te.Types.order)}return i}sort(){return super.sort.apply(this,arguments),this.trigger(te.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(te.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(i,r){const o=[];for(let s=0;s<this.length;s++){const a=this[s];let l;r?l=i.call(r,a,s):l=i(a,s),o.push(l)}return o}}xt=new WeakMap;const jd=Array.prototype.slice;function Q0(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}const We={isNaN:function(n){return typeof n=="number"&&n!==+n},isElement:function(n){return!!(n&&n.nodeType===1)},isObject:function(n){const e=typeof n;return e==="function"||e==="object"&&!!n},isFunction:function(n){return typeof n=="function"},extend:function(n){const e=jd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]=r[o]}return n},defaults:function(n){const e=jd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]===void 0&&(n[o]=r[o])}return n},each:function(n,e,i){const r=i||this,o=!Q0(n)&&Object.keys(n),s=(o||n).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,n[l],l,n)}return n},performance:Tn.performance&&Tn.performance.now?Tn.performance:Date},Ut=class Ut extends Vr{constructor(i,r,o){super();N(this,"_flagOffset",!0);N(this,"_flagOpacity",!0);N(this,"_flagColor",!0);N(this,"_offset",0);N(this,"_opacity",1);N(this,"_color","#fff");for(let s in qd)Object.defineProperty(this,s,qd[s]);this._renderer.type="stop",this.offset=typeof i=="number"?i:Ut.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Ut.Index<=0?"#fff":"#000",Ut.Index=(Ut.Index+1)%2}static fromObject(i){const r=new Ut().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Ut.Properties.length;r++){const o=Ut.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Ut;return We.each(Ut.Properties,function(o){r[o]=this[o]},this),i&&i.stops&&i.stops.push(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="stop",We.each(Ut.Properties,r=>{i[r]=this[r]},this),i}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};N(Ut,"Index",0),N(Ut,"Properties",["offset","opacity","color"]);let Bi=Ut;const qd={offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset=n,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(n){this._color=n,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Mn=class Mn extends Vr{constructor(i){super();N(this,"_flagStops",!1);N(this,"_flagSpread",!1);N(this,"_flagUnits",!1);N(this,"_spread","");N(this,"_units","");for(let r in Xd)Object.defineProperty(this,r,Xd[r]);this._renderer.type="gradient",this._renderer.flagStops=J0.bind(this),this._renderer.bindStops=e1.bind(this),this._renderer.unbindStops=t1.bind(this),this.spread="pad",this.units="objectBoundingBox",i&&(this.stops=i)}static fromObject(i){let r=i.stops;r&&r.length>0&&(r=r.map(s=>s instanceof Bi?s:new Bi().copy(s)));const o=new Mn(r).copy(i);return"id"in i&&(o.id=i.id),o}clone(i){const r=this.stops.map(s=>s.clone()),o=new Mn(r);return We.each(Mn.Properties,s=>{o[s]=this[s]},this),i&&i.add(o),o}copy(i){super.copy.call(this,i);for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];o in i&&(this[o]=i[o])}return this}toObject(){const i={stops:this.stops.map(r=>r.toObject())};return We.each(Mn.Properties,r=>{i[r]=this[r]},this),i}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};N(Mn,"Stop",Bi),N(Mn,"Properties",["spread","stops","units"]);let ft=Mn;const Xd={spread:{enumerable:!0,get:function(){return this._spread},set:function(n){this._spread=n,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(n){this._units=n,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(n){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._stops=new Si((n||[]).slice(0)),this._stops.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._stops)}}};function J0(){this._flagStops=!0}function e1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function t1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}const yi=class yi extends ft{constructor(i,r,o,s,a){super(a);N(this,"_flagEndPoints",!1);N(this,"_left",null);N(this,"_right",null);for(let l in Yd)Object.defineProperty(this,l,Yd[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=n1.bind(this),this.left=new ge,this.right=new ge,typeof i=="number"&&(this.left.x=i),typeof r=="number"&&(this.left.y=r),typeof o=="number"&&(this.right.x=o),typeof s=="number"&&(this.right.y=s)}static fromObject(i){const r=new yi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<yi.Properties.length;r++){const o=yi.Properties[r];o in i&&(this[o]=i[o]instanceof ge?i[o]:new ge().copy(i[o]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new yi(this.left._x,this.left._y,this.right._x,this.right._y,r);return We.each(ft.Properties,function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return i.left=this.left.toObject(),i.right=this.right.toObject(),i}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};N(yi,"Stop",Bi),N(yi,"Properties",["left","right"]);let Mt=yi;const Yd={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof ge&&this._left.unbind(te.Types.change,this._renderer.flagEndPoints),this._left=n,this._left.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(n){this._right instanceof ge&&this._right.unbind(te.Types.change,this._renderer.flagEndPoints),this._right=n,this._right.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function n1(){this._flagEndPoints=!0}const In=class In extends ft{constructor(i,r,o,s,a,l){super(s);N(this,"_flagRadius",!1);N(this,"_flagCenter",!1);N(this,"_flagFocal",!1);N(this,"_radius",0);N(this,"_center",null);N(this,"_focal",null);for(let c in Ud)Object.defineProperty(this,c,Ud[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=i1.bind(this),this._renderer.flagFocal=r1.bind(this),this.center=new ge,this.radius=typeof o=="number"?o:1,this.focal=new ge,typeof i=="number"&&(this.center.x=i),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(i){const r=new In().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];o in i&&(/(center|focal)i/.test(o)?this[o]=i[o]instanceof ge?i[o]:new ge().copy(i[o]):typeof i[o]=="number"&&(this[o]=i[MediaKeySystemAccess]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new In(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return We.each(ft.Properties.concat(In.Properties),function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return We.each(In.Properties,function(r){i[r]=this[r]},this),i.center=this.center.toObject(),i.focal=this.focal.toObject(),i}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};N(In,"Stop",Bi),N(In,"Properties",["center","radius","focal"]);let It=In;const Ud={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(n){this._center&&this._center.unbind(te.Types.change,this._renderer.flagCenter),this._center=n,this._center.bind(te.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(n){this._focal&&this._focal.unbind(te.Types.change,this._renderer.flagFocal),this._focal=n,this._focal.bind(te.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function i1(){this._flagCenter=!0}function r1(){this._flagFocal=!0}function Kd(n,e){if(e===0||e===1)return!0;const r=n._length*e;let o=0;for(let s=0;s<n._lengths.length;s++){const a=n._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function Oo(n,e){const i=n._length;if(e<=0)return 0;if(e>=i)return n._lengths.length-1;for(let r=0,o=0;r<n._lengths.length;r++){if(o+n._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/n._lengths[r];o+=n._lengths[r]}return-1}function Gd(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),j0(r,l,o,c,s,d,a,u,i)}function fa(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),Dd(r,l,o,c,s,d,a,u,i)}function Ni(n){switch(n.renderer.type){case"texture":return Qe.fromObject(n);case"gradient":return ft.fromObject(n);case"linear-gradient":return Mt.fromObject(n);case"radial-gradient":return It.fromObject(n)}return n}const o1=Math.cos,s1=Math.sin,Zd=Math.tan,ha=[],Ot=class Ot extends te{constructor(i,r,o,s,a,l){super();N(this,"elements",new Ad(9));N(this,"manual",!1);let c=i;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(i,r,o){if(r.length<=3){const w=i;let T,C,$;const E=r[0]||0,I=r[1]||0,R=r[2]||0;return T=w[0]*E+w[1]*I+w[2]*R,C=w[3]*E+w[4]*I+w[5]*R,$=w[6]*E+w[7]*I+w[8]*R,[T,C,$]}const s=i[0],a=i[1],l=i[2],c=i[3],d=i[4],u=i[5],f=i[6],h=i[7],p=i[8],m=r[0],g=r[1],b=r[2],y=r[3],_=r[4],k=r[5],x=r[6],v=r[7],B=r[8];return o=o||new Ad(9),o[0]=s*m+a*y+l*x,o[1]=s*g+a*_+l*v,o[2]=s*b+a*k+l*B,o[3]=c*m+d*y+u*x,o[4]=c*g+d*_+u*v,o[5]=c*b+d*k+u*B,o[6]=f*m+h*y+p*x,o[7]=f*g+h*_+p*v,o[8]=f*b+h*k+p*B,o}static fromObject(i){return new Ot().copy(i)}set(i,r,o,s,a,l,c,d,u){if(typeof r>"u"){const f=i;i=f[0],r=f[1],o=f[2],s=f[3],a=f[4],l=f[5],c=f[6],d=f[7],u=f[8]}return this.elements[0]=i,this.elements[1]=r,this.elements[2]=o,this.elements[3]=s,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=u,this.trigger(te.Types.change)}copy(i){return this.elements[0]=i.elements[0],this.elements[1]=i.elements[1],this.elements[2]=i.elements[2],this.elements[3]=i.elements[3],this.elements[4]=i.elements[4],this.elements[5]=i.elements[5],this.elements[6]=i.elements[6],this.elements[7]=i.elements[7],this.elements[8]=i.elements[8],this.manual=i.manual,this.trigger(te.Types.change)}identity(){return this.elements[0]=Ot.Identity[0],this.elements[1]=Ot.Identity[1],this.elements[2]=Ot.Identity[2],this.elements[3]=Ot.Identity[3],this.elements[4]=Ot.Identity[4],this.elements[5]=Ot.Identity[5],this.elements[6]=Ot.Identity[6],this.elements[7]=Ot.Identity[7],this.elements[8]=Ot.Identity[8],this.trigger(te.Types.change)}multiply(i,r,o,s,a,l,c,d,u){if(typeof r>"u")return this.elements[0]*=i,this.elements[1]*=i,this.elements[2]*=i,this.elements[3]*=i,this.elements[4]*=i,this.elements[5]*=i,this.elements[6]*=i,this.elements[7]*=i,this.elements[8]*=i,this.trigger(te.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){i=i||0,r=r||0,o=o||0,a=this.elements;const U=a[0]*i+a[1]*r+a[2]*o,Q=a[3]*i+a[4]*r+a[5]*o,G=a[6]*i+a[7]*r+a[8]*o;return[U,Q,G]}const f=this.elements,h=[i,r,o,s,a,l,c,d,u],p=f[0],m=f[1],g=f[2],b=f[3],y=f[4],_=f[5],k=f[6],x=f[7],v=f[8],B=h[0],w=h[1],T=h[2],C=h[3],$=h[4],E=h[5],I=h[6],R=h[7],O=h[8];return this.elements[0]=p*B+m*C+g*I,this.elements[1]=p*w+m*$+g*R,this.elements[2]=p*T+m*E+g*O,this.elements[3]=b*B+y*C+_*I,this.elements[4]=b*w+y*$+_*R,this.elements[5]=b*T+y*E+_*O,this.elements[6]=k*B+x*C+v*I,this.elements[7]=k*w+x*$+v*R,this.elements[8]=k*T+x*E+v*O,this.trigger(te.Types.change)}inverse(i){const r=this.elements;i=i||new Ot;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],f=r[7],h=r[8],p=h*c-d*f,m=-h*l+d*u,g=f*l-c*u;let b=o*p+s*m+a*g;return b?(b=1/b,i.elements[0]=p*b,i.elements[1]=(-h*s+a*f)*b,i.elements[2]=(d*s-a*c)*b,i.elements[3]=m*b,i.elements[4]=(h*o-a*u)*b,i.elements[5]=(-d*o+a*l)*b,i.elements[6]=g*b,i.elements[7]=(-f*o+s*u)*b,i.elements[8]=(c*o-s*l)*b,i):null}scale(i,r){return arguments.length<=1&&(r=i),this.multiply(i,0,0,0,r,0,0,0,1)}rotate(i){const r=o1(i),o=s1(i);return this.multiply(r,-o,0,o,r,0,0,0,1)}translate(i,r){return this.multiply(1,0,i,0,1,r,0,0,1)}skewX(i){const r=Zd(i);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(i){const r=Zd(i);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(i){return ha.length=0,this.toTransformArray(i,ha),ha.map($n).join(" ")}toTransformArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=d,r[2]=h,r[3]=l,r[4]=u,r[5]=p,r[6]=c,r[7]=f,r[8]=m;return}return[a,d,h,l,u,p,c,f,m]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=f;return}return[a,d,l,u,c,f]}toArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f,r[6]=h,r[7]=p,r[8]=m;return}return[a,l,c,d,u,f,h,p,m]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f;return}return[a,l,c,d,u,f]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ot().copy(this)}};N(Ot,"Identity",[1,0,0,0,1,0,0,0,1]);let or=Ot;D0(or);const eo=class eo extends Vr{constructor(){super();N(this,"_flagMatrix",!0);N(this,"_flagScale",!1);N(this,"_matrix",null);N(this,"_worldMatrix",null);N(this,"_position",null);N(this,"_rotation",0);N(this,"_scale",1);N(this,"_skewX",0);N(this,"_skewY",0);for(let i in zo)Object.defineProperty(this,i,zo[i]);this._renderer.flagMatrix=Qd.bind(this),this.isShape=!0,this.matrix=new or,this.worldMatrix=new or,this.position=new ge,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(i){const r=new eo().copy(i);return"id"in i&&(r.id=i.id),r}get renderer(){return this._renderer}set renderer(i){this._renderer=i}get translation(){return zo.position.get.apply(this,arguments)}set translation(i){zo.position.set.apply(this,arguments)}addTo(i){return i.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&"visible"in this&&this.visible===!1||!a&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();return c?i>=c.left-l&&i<=c.right+l&&r>=c.top-l&&r<=c.bottom+l:!1}copy(i){return super.copy.call(this,i),"position"in i&&(i.position instanceof ge?this.position=i.position:this.position.copy(i.position)),"rotation"in i&&(this.rotation=i.rotation),"scale"in i&&(this.scale=typeof i.scale=="number"||i.scale instanceof ge?i.scale:new ge(i.scale.x,i.scale.y)),"skewX"in i&&(this.skewX=i.skewX),"skewY"in i&&(this.skewY=i.skewY),"matrix"in i&&i.matrix.manual&&(this.matrix.copy(i.matrix),this.matrix.manual=!0),this}clone(i){const r=new eo;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer={type:"shape"},i.isShape=!0,i.translation=this.translation.toObject(),i.rotation=this.translation.rotation,i.scale=this.scale instanceof ge?this.scale.toObject():this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.matrix=this.matrix.toObject(),i}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(i){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof ge?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),i&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};N(eo,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let En=eo;const zo={position:{enumerable:!0,get:function(){return this._position},set:function(n){this._position&&this._position.unbind(te.Types.change,this._renderer.flagMatrix),this._position=n,this._position.bind(te.Types.change,this._renderer.flagMatrix),Qd.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(n){this._rotation=n,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ge&&this._scale.unbind(te.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof ge&&this._scale.bind(te.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(n){this._skewX=n,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(n){this._skewY=n,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(n){this._matrix=n,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return L0(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function Qd(){this._flagMatrix=!0}const Jd=/^(?:none|transparent)$/i,a1=8,ma=Number.EPSILON;function jn(n,e){return{x:n,y:e}}function Do(n,e,i=ma){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function eu(n,e,i,r){const o=n*i+e*r,s=Math.sqrt(n*n+e*e)*Math.sqrt(i*i+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return n*r-e*i<0&&(a=-a),a}function l1(n,e,i){if(!n)return[jn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[jn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=n.x,d=n.y,u=e.x,f=e.y,h=(c-u)/2,p=(d-f)/2,m=Math.cos(s),g=Math.sin(s);let b=m*h+g*p,y=-g*h+m*p,_=r*r,k=o*o;const x=b*b/_+y*y/k;if(x>1){const D=Math.sqrt(x);r*=D,o*=D,_=r*r,k=o*o}const v=_*y*y+k*b*b,B=v===0?0:(_*k-v)/v;let w=Math.sqrt(Math.max(0,B));a===l&&(w=-w);const T=w*r*y/o,C=-w*o*b/r,$=m*T-g*C+(c+u)/2,E=g*T+m*C+(d+f)/2,I=eu(1,0,(b-T)/r,(y-C)/o),R=eu((b-T)/r,(y-C)/o,(-b-T)/r,(-y-C)/o)%Zt,O=I+R,U=l===0,Q=(()=>{const D=O-I,L=Math.abs(D)<Number.EPSILON;let z=qt(D,Zt);return z<Number.EPSILON&&(z=L?0:Zt),U&&!L&&(z=z===Zt?-Zt:z-Zt),z})(),G=Math.max(Fo.Resolution,Math.max(i*2,1)),W=[];for(let D=1;D<=G;D++){const L=D/G,z=I+L*Q;let P=$+r*Math.cos(z),q=E+o*Math.sin(z);if(s!==0){const K=P-$,J=q-E,Y=Math.cos(s),V=Math.sin(s);P=K*Y-J*V+$,q=K*V+J*Y+E}W.push(jn(P,q))}return W}function c1(n,e=a1){const i=[],r=[],o=n._renderer&&n._renderer.vertices&&n._renderer.vertices.length>0?n._renderer.vertices:n.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(h=!1)=>{if(a){if(h&&l&&c&&!Do(l,c)){const p=jn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&Do(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}Do(c,h)||(r.push({a:c,b:h}),a&&a.push(h),c=h)};for(let h=0;h<o.length;h++){const p=o[h],m=p.command||(h===0?fe.move:fe.line);if(m===fe.move){u(!1);const g=jn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===fe.line)f(jn(p.x,p.y));else if(m===fe.curve){const g=fa(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(jn(y.x,y.y))}f(jn(p.x,p.y))}else if(m===fe.arc){const g=l1(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===fe.close){u(!0),d=p;continue}else f(jn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!Do(l,c);u(h)}return{polygons:i,segments:r}}function d1(n,e,i){let r=!1;for(let o=0;o<n.length;o++){const s=n[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function u1(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<ma&&Math.abs(s)<ma){const h=n-i.x,p=e-i.y;return h*h+p*p}const a=((n-i.x)*o+(e-i.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=i.x+l*o,d=i.y+l*s,u=n-c,f=e-d;return u*u+f*f}function f1(n,e,i){if(!n||n.length===0)return 1/0;let r=1/0;for(let o=0;o<n.length;o++){const s=n[o],a=u1(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function h1(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!Jd.test(i):!0}function m1(n,e){const i=typeof n.linewidth=="number"?n.linewidth:n._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=n.stroke;return!r&&r!==0?!1:typeof r=="string"?!Jd.test(r):!0}function p1(n,e,i,r=0){if(!n)return!1;const o=n.left-r,s=n.right+r,a=n.top-r,l=n.bottom+r;return e>=o&&e<=s&&i>=a&&i<=l}const Lo=Number.EPSILON;function Ho(n){return typeof n.relative!="boolean"||!!n.relative}function gn(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<Lo&&Math.abs(r)<Lo){Ho(n)?o[e].clear():o[e].set(n.x,n.y);return}Ho(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Xt(n,e){gn(n,e,0,0)}function g1(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:Ho(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function sr(n,e){const i=g1(n,e);return Math.abs(i.x)>Lo||Math.abs(i.y)>Lo}function Wo(n){n.command===fe.move||n.command===fe.close||(n.command=sr(n,"left")||sr(n,"right")?fe.curve:fe.line)}function tu(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function y1(n,e){return sr(e,"right")||sr(n,"left")||sr(n,"right")||sr(e,"left")||n.command===fe.curve||e.command===fe.curve}function ar(n,e,i){return{x:jt(n.x,e.x,i),y:jt(n.y,e.y,i)}}function nu(n,e){const i=n.controls&&n.controls[e];return i?Ho(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function b1(n,e,i){const r=n.controls&&n.controls.right,o=e.controls&&e.controls.left,s={x:n.x,y:n.y},a=r?nu(n,"right"):{...s},l={x:e.x,y:e.y},c=o?nu(e,"left"):{...l},d=ar(s,a,i),u=ar(a,c,i),f=ar(c,l,i),h=ar(d,u,i),p=ar(u,f,i),m=ar(h,p,i),g=new Ie(m.x,m.y);return tu(g,n),gn(g,"left",h.x-m.x,h.y-m.y),gn(g,"right",p.x-m.x,p.y-m.y),g.command=fe.curve,{anchor:g,startOut:d,endIn:f}}function _1(n,e,i,r,o,s){const a=n.length,l=i-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,a-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let w=0,T=e-u;w<=c;w+=1,T+=1){const C=qt(T,a);h[w]=n[C]}let p=h[0].x+2*h[1].x,m=h[0].y+2*h[1].y,g=2;const b=c-1,y=[p],_=[m],k=[g],x=new Array(c+1),v=new Array(c+1);for(let w=1;w<c;w+=1){const T=w<b,C=T||s?1:2,$=T?4:s?2:7,E=T?4:s?3:8,I=T?2:s?0:1,R=C/g;g=k[w]=$-R,p=y[w]=E*h[w].x+I*h[w+1].x-R*p,m=_[w]=E*h[w].y+I*h[w+1].y-R*m}x[b]=y[b]/k[b],v[b]=_[b]/k[b];for(let w=c-2;w>=0;w-=1)x[w]=(y[w]-x[w+1])/k[w],v[w]=(_[w]-v[w+1])/k[w];x[c]=(3*h[c].x-x[b])/2,v[c]=(3*h[c].y-v[b])/2;const B=c-f;for(let w=u,T=e;w<=B;w+=1,T+=1){const C=qt(T,a),$=n[C],E=x[w]-$.x,I=v[w]-$.y;o||w<B?gn($,"right",E,I):Xt($,"right"),o||w>u?gn($,"left",-E,-I):Xt($,"left"),Wo($)}}function w1(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=ge.distanceBetween(a,l),u=ge.distanceBetween(l,c),f=r===void 0?.5:r,h=Math.pow(d,f),p=Math.pow(u,f),m=h*h,g=p*p;if(!o&&e){const b=2*g+3*p*h+m,y=3*p*(p+h);if(y!==0){const _=(g*a.x+b*l.x-m*c.x)/y-l.x,k=(g*a.y+b*l.y-m*c.y)/y-l.y;gn(n,"left",_,k)}else Xt(n,"left")}else Xt(n,"left");if(!s&&i){const b=2*m+3*h*p+g,y=3*h*(h+p);if(y!==0){const _=(m*c.x+b*l.x-g*a.x)/y-l.x,k=(m*c.y+b*l.y-g*a.y)/y-l.y;gn(n,"right",_,k)}else Xt(n,"right")}else Xt(n,"right");Wo(n)}function x1(n,e,i,r,o,s){if(!(e&&i)){e||Xt(n,"left"),i||Xt(n,"right"),Wo(n);return}const a=e,l=n,c=i,d=ge.distanceBetween(a,l),u=ge.distanceBetween(l,c),f=d+u,h=r===void 0?.4:r,p={x:a.x-c.x,y:a.y-c.y};if(!o&&f!==0){const m=h*d/f;gn(n,"left",p.x*m,p.y*m)}else Xt(n,"left");if(!s&&f!==0){const m=h*d/f-h;gn(n,"right",p.x*m,p.y*m)}else Xt(n,"right");Wo(n)}function k1(n,e,i,r,o,s){const a=s.type,l=s.factor,c=n.length;for(let d=e;d<=i;d+=1){const u=qt(d,c),f=n[u];if(f.command===fe.move){Xt(f,"left"),Xt(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[qt(h,c)],g=p===null?null:n[qt(p,c)],b=h===null,y=p===null;a==="geometric"?x1(f,m,g,l,b,y):w1(f,m,g,l,b,y)}}const lr=Math.min,cr=Math.max,C1=Math.ceil,v1=Math.floor,S1=new ge,B1=new or,_n=class _n extends En{constructor(i,r,o,s){super();N(this,"_flagVertices",!0);N(this,"_flagLength",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagCap",!0);N(this,"_flagJoin",!0);N(this,"_flagMiter",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_flagMask",!1);N(this,"_flagClip",!1);N(this,"_length",0);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_cap","round");N(this,"_join","round");N(this,"_miter",4);N(this,"_closed",!0);N(this,"_curved",!1);N(this,"_automatic",!0);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_mask",null);N(this,"_clip",!1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);for(let a in iu)Object.defineProperty(this,a,iu[a]);this._renderer.type="path",this._renderer.flagVertices=ru.bind(this),this._renderer.bindVertices=ou.bind(this),this._renderer.unbindVertices=su.bind(this),this._renderer.flagFill=au.bind(this),this._renderer.flagStroke=lu.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!r,this.curved=!!o,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=i,this.automatic=!s,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new _n().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){if(super.copy.call(this,i),i.vertices){this.vertices=[];for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ie?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ie().copy(o))}}for(let r=0;r<_n.Properties.length;r++){const o=_n.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new _n;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<_n.Properties.length;o++){const s=_n.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="path",i.vertices=this.vertices.map(r=>r.toObject()),We.each(_n.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const i=this.getBoundingClientRect(!0),r=i.width/2,o=i.height/2,s=i.left+i.width/2,a=i.top+i.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=s,c.y-=a,c.x+=r,c.y+=o}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=o),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const a=this.vertices[s];a.x-=r,a.y-=o}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getBoundingClientRect(i){let r,o,s,a,l,c,d=1/0,u=-1/0,f=1/0,h=-1/0;if(this._update(!0),r=i?this.matrix:this.worldMatrix,o=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:p,scaleY:m}=z0(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof p=="number"&&typeof m=="number"&&(o=Math.max(p,m)*(this.linewidth||0)/2)}else o*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(a=0;a<s;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+s-1)%s];const[p,m]=r.multiply(l.x,l.y),[g,b]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let y=l.controls.right.x,_=l.controls.right.y;l.relative&&(y+=l.x,_+=l.y);let[k,x]=r.multiply(y,_),v=c.controls.left.x,B=c.controls.left.y;c.relative&&(v+=c.x,B+=c.y);let[w,T]=r.multiply(v,B);const C=q0(p,m,k,x,w,T,g,b);f=lr(C.min.y-o,f),d=lr(C.min.x-o,d),u=cr(C.max.x+o,u),h=cr(C.max.y+o,h)}else a<=1&&(f=lr(m-o,f),d=lr(p-o,d),u=cr(p+o,u),h=cr(m+o,h)),f=lr(b-o,f),d=lr(g-o,d),u=cr(g+o,u),h=cr(b+o,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&this.visible===!1||!a&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();if(!c||i<c.left-l||i>c.right+l||r<c.top-l||r>c.bottom+l)return!1;const d=this.worldMatrix,u=d&&d.inverse(B1);if(!u)return super.contains(i,r,s);const[f,h]=u.multiply(i,r,1),p=typeof s.precision=="number"&&!Number.isNaN(s.precision)?Math.max(1,Math.floor(s.precision)):8,m=h1(this,s.fill),g=m1(this,s.stroke),{polygons:b,segments:y}=c1(this,p);if(m&&b.length>0&&d1(b,f,h))return!0;if(g&&y.length>0){const _=typeof this.linewidth=="number"?this.linewidth:0;if(_>0&&f1(y,f,h)<=_/2+l)return!0}return!m&&!g?super.contains(i,r,s):m&&b.length===0?super.contains(i,r,s):!1}getPointAt(i,r){let o,s,a,l,c,d,u,f,h,p,m,g,b,y,_,k=this.length*Math.min(Math.max(i,0),1);const x=this.vertices.length,v=x-1;let B=null,w=null;for(let W=0,D=this._lengths.length,L=0;W<D;W++){if(L+this._lengths[W]>=k){this._closed?(o=qt(W,x),s=qt(W-1,x),W===0&&(o=s,s=W)):(o=W,s=Math.min(Math.max(W-1,0),v)),B=this.vertices[o],w=this.vertices[s],k-=L,this._lengths[W]!==0?i=k/this._lengths[W]:i=0;break}L+=this._lengths[W]}if(B===null||w===null)return null;if(B){if(!w)return B}else return w;_=w.controls&&w.controls.right,y=B.controls&&B.controls.left,c=w.x,p=w.y,d=(_||w).x,m=(_||w).y,u=(y||B).x,g=(y||B).y,f=B.x,b=B.y,_&&w.relative&&(d+=w.x,m+=w.y),y&&B.relative&&(u+=B.x,g+=B.y),l=Mo(i,c,d,u,f),h=Mo(i,p,m,g,b);const T=jt(c,d,i),C=jt(p,m,i),$=jt(d,u,i),E=jt(m,g,i),I=jt(u,f,i),R=jt(g,b,i),O=jt(T,$,i),U=jt(C,E,i),Q=jt($,I,i),G=jt(E,R,i);return We.isObject(r)?(r.x=l,r.y=h,r instanceof Ie&&(r.controls.left.x=O,r.controls.left.y=U,r.controls.right.x=Q,r.controls.right.y=G,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=h,r.controls.right.x-=l,r.controls.right.y-=h)),r.t=i,r):(a=new Ie(l,h,O-l,U-h,Q-l,G-h,this._curved?fe.curve:fe.line),a.t=i,a)}plot(){if(this.curved)return Y0(this._collection,this.closed),this;for(let i=0;i<this._collection.length;i++)this._collection[i].command=i===0?fe.move:fe.line;return this}smooth(i){const r=i||{},o=r.type||"continuous",s=this._collection,a=s.length;if(a<2)return this;const l=this._closed||a>0&&s[a-1]&&s[a-1].command===fe.close,c=(p,m)=>{if(p==null)return m;if(typeof p=="number"){if(l)return qt(p,a);let b=p;return b<0&&(b+=a),Math.min(Math.max(b,0),a-1)}const g=s.indexOf(p);return g!==-1?g:m},d=l&&r.from===void 0&&r.to===void 0;let u=c(r.from,0),f=c(r.to,a-1);if(u>f)if(l)u-=a;else{const p=u;u=f,f=p}const h=f-u+1;for(let p=0;p<h;p+=1){const m=qt(u+p,a),g=s[m],b=!l&&m===0;g.command===fe.move&&!b&&(g.command=fe.line)}if(o==="continuous"||o==="asymmetric")_1(s,u,f,l,d,o==="asymmetric");else if(o==="catmull-rom"||o==="geometric"){const p={type:o,factor:r.factor};k1(s,u,f,l,d,p)}else throw new Error(`Path.smooth does not support type "${o}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(i){this._update();const r=this.vertices,o=r.length;if(o<2)return this;const s=[];let a=null,l=null;for(let c=0;c<o;c+=1){const d=r[c];if(!a||d.command===fe.move){const f=d.clone();s.push(f),a=d,l=d;continue}if(y1(d,a)){const h=fa(d,a,i).length,p=s[s.length-1];let m=p.clone(),g=d.clone(),b=p,y=0;if(h<=1){const _=d.clone();s.push(_)}else{for(let k=1;k<h;k+=1){const x=k/h,v=1-y,B=v<=Number.EPSILON?x:(x-y)/v,w=b1(m,g,B);gn(b,"right",w.startOut.x-b.x,w.startOut.y-b.y);const T=w.anchor;s.push(T),b=T,m=T.clone(),y=x,gn(g,"left",w.endIn.x-g.x,w.endIn.y-g.y)}const _=d.clone();_.controls.left.copy(g.controls.left),s.push(_)}}else{const f=fa(d,a,i);for(let p=1;p<f.length;p+=1){const m=f[p];tu(m,a),Xt(m,"left"),Xt(m,"right"),m.command=fe.line,s.push(m)}const h=d.clone();s.push(h)}a=d,d.command===fe.close&&(a=l)}return this._automatic=!1,this._curved=!1,this.vertices=s,this}_updateLength(i,r){r||this._update();const s=this.vertices.length-1;let a=this.vertices[s],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),We.each(this.vertices,function(c,d){if(d<=0||c.command===fe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=Gd(c,a,i),l+=this._lengths[d],a=c},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const i=this._collection.length,r=this._closed,o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=Oo(this,o*this._length),l=Oo(this,s*this._length),c=C1(a),d=v1(l);let u,f,h,p,m,g;for(this._renderer.vertices.length=0,g=0;g<i;g++)this._renderer.collection.length<=g&&this._renderer.collection.push(new Ie),g>d&&!f?(m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(s,m),m.command=this._renderer.collection[g].command,this._renderer.vertices.push(m),f=m,h=this._collection[g-1],h&&h.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),h.relative?this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(ge.zero,1-m.t):this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(h,1-m.t))):g>=c&&g<=d&&(m=this._renderer.collection[g].copy(this._collection[g]),this._renderer.vertices.push(m),g===d&&Kd(this,s)?(f=m,!r&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):g===c&&Kd(this,o)&&(u=m,u.command=fe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(g=c-1,m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(o,m),m.command=fe.move,this._renderer.vertices.unshift(m),p=this._collection[g+1],p&&p.controls&&(m.controls.left.clear(),p.relative?this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(ge.zero,m.t):(S1.copy(p),this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(p,m.t))))}return En.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,En.prototype.flagReset.call(this),this}};N(_n,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),N(_n,"Utils",{getCurveLength:Gd});let Ae=_n;const iu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=!!n,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=!!n,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){if(n===this._automatic)return;this._automatic=!!n;const e=this._automatic?"ignore":"listen";We.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Si?this._collection=n:this._collection=new Si(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function ru(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function ou(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function su(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function au(){this._flagFill=!0}function lu(){this._flagStroke=!0}const N1=Math.ceil,T1=Math.floor,An=class An extends En{constructor(i){super();N(this,"_flagVertices",!0);N(this,"_flagLength",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagSize",!0);N(this,"_flagSizeAttenuation",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_length",0);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_size",1);N(this,"_sizeAttenuation",!1);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);N(this,"noFill",Ae.prototype.noFill);N(this,"noStroke",Ae.prototype.noStroke);N(this,"corner",Ae.prototype.corner);N(this,"center",Ae.prototype.center);N(this,"getBoundingClientRect",Ae.prototype.getBoundingClientRect);N(this,"_updateLength",Ae.prototype._updateLength);for(let r in cu)Object.defineProperty(this,r,cu[r]);this._renderer.type="points",this._renderer.flagVertices=ru.bind(this),this._renderer.bindVertices=ou.bind(this),this._renderer.unbindVertices=su.bind(this),this._renderer.flagFill=au.bind(this),this._renderer.flagStroke=lu.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=i,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new An().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ie?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ie().copy(o))}for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new An;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<An.Properties.length;o++){const s=An.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="points",i.vertices=this.vertices.map(r=>r.toObject()),We.each(An.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(i){this._update();let r=[];for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o],a=this.vertices[o-1];if(!a)continue;const l=s.x,c=s.y,d=a.x,u=a.y,f=Dd(l,c,l,c,d,u,d,u,i);r=r.concat(f)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const i=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),o=Oo(this,i*this._length),s=Oo(this,r*this._length),a=N1(o),l=T1(s);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let u=0;u<this._collection.length;u++)u>=a&&u<=l&&(d=this._collection[u],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};N(An,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let jo=An;const cu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(n){this._sizeAttenuation=n,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Si?this._collection=n:this._collection=new Si(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};class du extends Si{constructor(i){i=Array.isArray(i)?i:Array.prototype.slice.call(arguments);super(i);Il(this,ys,{});this.attach(i),this.on(te.Types.insert,this.attach),this.on(te.Types.remove,this.detach)}get ids(){return Dt(this,ys)}attach(i){for(let r=0;r<i.length;r++){const o=i[r];o&&o.id&&(this.ids[o.id]=o)}return this}detach(i){for(let r=0;r<i.length;r++)delete this.ids[i[r].id];return this}}ys=new WeakMap;const Kn=class Kn extends Ae{constructor(i,r,o,s,a,l,c){const d=c||Fo.Resolution*3,u=[];for(let f=0;f<d;f++)u.push(new Ie);super(u,!0,!1,!0);N(this,"_flagStartAngle",!1);N(this,"_flagEndAngle",!1);N(this,"_flagInnerRadius",!1);N(this,"_flagOuterRadius",!1);N(this,"_startAngle",0);N(this,"_endAngle",Zt);N(this,"_innerRadius",0);N(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let f in uu)Object.defineProperty(this,f,uu[f]);typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Kn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Kn.Properties.length;r++){const o=Kn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const i=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=qt(i,Zt)===qt(r,Zt),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,f=0,h,p,m,g,b,y,_,k,x;for(a?d--:l||(d-=2),h=0,p=d-1;h<d;h++){switch(m=h/p,g=c[f],b=m*(r-i)+i,y=(r-i)/d,_=s*Math.cos(b),k=s*Math.sin(b),h){case 0:u=fe.move;break;default:u=fe.curve}g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===fe.curve&&(x=s*y/Math.PI,g.controls.left.x=x*Math.cos(b-bt),g.controls.left.y=x*Math.sin(b-bt),g.controls.right.x=x*Math.cos(b+bt),g.controls.right.y=x*Math.sin(b+bt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++}if(l){for(a?(c[f].command=fe.close,f++):(d--,p=d-1),h=0;h<d;h++)m=h/p,g=c[f],b=(1-m)*(r-i)+i,y=(r-i)/d,_=o*Math.cos(b),k=o*Math.sin(b),u=fe.curve,h<=0&&(u=a?fe.move:fe.line),g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===fe.curve&&(x=o*y/Math.PI,g.controls.left.x=x*Math.cos(b+bt),g.controls.left.y=x*Math.sin(b+bt),g.controls.right.x=x*Math.cos(b-bt),g.controls.right.y=x*Math.sin(b-bt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++;c[f].copy(c[0]),c[f].command=fe.line}else a||(c[f].command=fe.line,c[f].x=0,c[f].y=0,f++,c[f].copy(c[0]),c[f].command=fe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Kn(0,0,r,o,s,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Ae.Properties.length;d++){const u=Ae.Properties[d];c[u]=this[u]}return i&&i.add(c),c}toObject(){const i=super.toObject.call(this);i.renderer.type="arc-segment";for(let r=0;r<Kn.Properties.length;r++){const o=Kn.Properties[r];i[o]=this[o]}return i}};N(Kn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let pa=Kn;const uu={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(n){this._startAngle=n,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(n){this._endAngle=n,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}}},ga=Math.cos,ya=Math.sin,Gn=class Gn extends Ae{constructor(i,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ie(0,0,0,0,0,0));super(l,!0,!0,!0);N(this,"_flagRadius",!1);N(this,"_radius",0);this._renderer.type="circle";for(let c in fu)Object.defineProperty(this,c,fu[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Gn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Gn.Properties.length;r++){const o=Gn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagRadius){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(i*2)),o=this._radius,s=o*r;for(let a=0;a<this.vertices.length;a++){const c=a/i*Zt,d=o*ga(c),u=o*ya(c),f=s*ga(c-bt),h=s*ya(c-bt),p=s*ga(c+bt),m=s*ya(c+bt),g=this.vertices[a];g.command=a===0?fe.move:fe.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(i){const r=new Gn(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="circle";for(let r=0;r<Gn.Properties.length;r++){const o=Gn.Properties[r];i[o]=this[o]}return i}};N(Gn,"Properties",["radius"]);let ba=Gn;const fu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},_a=Math.cos,wa=Math.sin,Zn=class Zn extends Ae{constructor(i,r,o,s,a){typeof s!="number"&&typeof o=="number"&&(s=o);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Ie);super(c,!0,!0,!0);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_width",0);N(this,"_height",0);this._renderer.type="ellipse";for(let d in hu)Object.defineProperty(this,d,hu[d]);typeof o=="number"&&(this.width=o*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Zn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Zn.Properties.length;r++){const o=Zn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),o=this._width/2,s=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/i*Zt,d=o*_a(c),u=s*wa(c),f=o*r*_a(c-bt),h=s*r*wa(c-bt),p=o*r*_a(c+bt),m=s*r*wa(c+bt),g=this.vertices[a];g.command=a===0?fe.move:fe.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new Zn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="ellipse";for(let r=0;r<Zn.Properties.length;r++){const o=Zn.Properties[r];i[o]=this[o]}return i}};N(Zn,"Properties",["width","height"]);let xa=Zn;const hu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}}},$1=Math.cos,E1=Math.sin,Qn=class Qn extends Ae{constructor(i,r,o,s){s=Math.max(s||0,3);super();N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_flagSides",!1);N(this,"_radius",0);N(this,"_width",0);N(this,"_height",0);N(this,"_sides",0);this._renderer.type="polygon";for(let a in mu)Object.defineProperty(this,a,mu[a]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.radius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Qn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const i=this._sides,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=Zt*a+Math.PI/2,c=this._width*$1(l)/2,d=this._height*E1(l)/2;s>=o?this.vertices.push(new Ie(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?fe.move:fe.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=new Qn(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="polygon";for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];i[o]=this[o]}return i}};N(Qn,"Properties",["width","height","sides"]);let ka=Qn;const mu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this.width=n*2,this.height=n*2}},width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},Hi=class Hi extends Ae{constructor(i,r,o,s){const a=[new Ie,new Ie,new Ie,new Ie];super(a,!0,!1,!0);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_width",0);N(this,"_height",0);N(this,"_origin",null);this._renderer.type="rectangle";for(let l in pu)Object.defineProperty(this,l,pu[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new ge,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(i){const r=new Hi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Hi.Properties.length;r++){const o=Hi.Properties[r];o in i&&(typeof i[o]=="number"?this[o]=i[o]:this[o]instanceof ge&&this[o].copy(i[o]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const i=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ie),this.vertices[0].set(-i,-r).sub(this._origin).command=fe.move,this.vertices[1].set(i,-r).sub(this._origin).command=fe.line,this.vertices[2].set(i,r).sub(this._origin).command=fe.line,this.vertices[3].set(-i,r).sub(this._origin).command=fe.line,this.vertices[4]&&(this.vertices[4].set(-i,-r).sub(this._origin).command=fe.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=new Hi(0,0,this.width,this.height);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]instanceof ge?r[s].copy(this[s]):r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="rectangle",i.width=this.width,i.height=this.height,i.origin=this.origin.toObject(),i}};N(Hi,"Properties",["width","height","origin"]);let Mr=Hi;const pu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(n){this._origin&&this._origin.unbind(te.Types.change,this._renderer.flagVertices),this._origin=n,this._origin.bind(te.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Jn=class Jn extends Ae{constructor(i,r,o,s,a){typeof a>"u"&&typeof o=="number"&&typeof s=="number"&&(a=Math.floor(Math.min(o,s)/12));const l=[];for(let c=0;c<10;c++)l.push(new Ie(0,0,0,0,0,0,c===0?fe.move:fe.curve));super(l);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_flagRadius",!1);N(this,"_width",0);N(this,"_height",0);N(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in gu)Object.defineProperty(this,c,gu[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=R1.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof ge)&&(this.radius=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Jn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];if(o in i){const s=i[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof ge?s:new ge().copy(s):typeof s=="number"&&(this[o]=s)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const i=this._width,r=this._height;let o,s;this._radius instanceof ge?(o=this._radius.x,s=this._radius.y):(o=this._radius,s=this._radius);let a,l=i/2,c=r/2;a=this.vertices[0],a.x=-(l-o),a.y=-c,a=this.vertices[1],a.x=l-o,a.y=-c,a.controls.left.clear(),a.controls.right.x=o,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-s),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-s,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=s,a=this.vertices[4],a.x=l-o,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-o),a.y=c,a.controls.left.clear(),a.controls.right.x=-o,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-s,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-s),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-s,a=this.vertices[8],a.x=-(l-o),a.y=-c,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[9],a.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(i){const r=this.width,o=this.height,s=this.radius,a=new Jn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="rounded-rectangle";for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];i[o]=this[o]}return i.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),i}};N(Jn,"Properties",["width","height","radius"]);let Ca=Jn;const gu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius instanceof ge&&this._radius.unbind(te.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof ge&&this._radius.bind(te.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function R1(){this._flagRadius=!0}const P1=Math.cos,F1=Math.sin,ei=class ei extends Ae{constructor(i,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();N(this,"_flagInnerRadius",!1);N(this,"_flagOuterRadius",!1);N(this,"_flagSides",!1);N(this,"_innerRadius",0);N(this,"_outerRadius",0);N(this,"_sides",0);this._renderer.type="star";for(let l in yu)Object.defineProperty(this,l,yu[l]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.sides=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ei().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const i=this._sides*2,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=Zt*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*P1(l),u=c*F1(l);s>=o?this.vertices.push(new Ie(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?fe.move:fe.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.sides,a=new ei(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="star";for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];i[o]=this[o]}return i}};N(ei,"Properties",["innerRadius","outerRadius","sides"]);let va=ei;const yu={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}};let Sa;const bu=Math.min,_u=Math.max;Tn.document&&(Sa=document.createElement("canvas"));const Rt=class Rt extends En{constructor(i,r,o,s){super();N(this,"_flagValue",!0);N(this,"_flagFamily",!0);N(this,"_flagSize",!0);N(this,"_flagLeading",!0);N(this,"_flagAlignment",!0);N(this,"_flagBaseline",!0);N(this,"_flagStyle",!0);N(this,"_flagWeight",!0);N(this,"_flagDecoration",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagMask",!1);N(this,"_flagClip",!1);N(this,"_flagDirection",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_value","");N(this,"_family","sans-serif");N(this,"_size",13);N(this,"_leading",17);N(this,"_alignment","center");N(this,"_baseline","middle");N(this,"_style","normal");N(this,"_weight",500);N(this,"_decoration","none");N(this,"_direction","ltr");N(this,"_fill","#000");N(this,"_stroke","none");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_mask",null);N(this,"_clip",!1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);for(let a in wu)Object.defineProperty(this,a,wu[a]);if(this._renderer.type="text",this._renderer.flagFill=V1.bind(this),this._renderer.flagStroke=M1.bind(this),this.value=i,typeof r=="number"&&(this.translation.x=r),typeof o=="number"&&(this.translation.y=o),this.dashes=[],this.dashes.offset=0,!We.isObject(s))return this;for(let a=0;a<Rt.Properties.length;a++){const l=Rt.Properties[a];l in s&&(this[l]=s[l])}}static Measure(i){if(Sa){const r=Sa.getContext("2d");r.font=[i._style,i._weight,`${i._size}px/${i._leading}px`,i._family].join(" ");const o=r.measureText(i.value,0,0),s=o.actualBoundingBoxDescent+o.actualBoundingBoxAscent;return{width:o.width,height:s}}else{const r=this.value.length*this.size*Rt.Ratio,o=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:r,height:o}}}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new Rt().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<Rt.Properties.length;r++){const o=Rt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Rt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<Rt.Properties.length;o++){const s=Rt.Properties[o];r[s]=this[s]}return this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);i.renderer.type="text";for(let r=0;r<Rt.Properties.length;r++){const o=Rt.Properties[r];i[o]=this[o]}return i}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(i){let r,o,s,a,l;this._update(!0),r=i?this.matrix:this.worldMatrix;const{width:c,height:d}=Rt.Measure(this),u=(this._linewidth||0)/2;switch(this.alignment){case"left":o=-u,s=c+u;break;case"right":o=-(c+u),s=u;break;default:o=-(c/2+u),s=c/2+u}switch(this.baseline){case"middle":a=-(d/2+u),l=d/2+u;break;default:a=-(d+u),l=u}const[f,h]=r.multiply(o,a),[p,m]=r.multiply(o,l),[g,b]=r.multiply(s,a),[y,_]=r.multiply(s,l);return a=bu(h,m,b,_),o=bu(f,p,g,y),s=_u(f,p,g,y),l=_u(h,m,b,_),{top:a,left:o,right:s,bottom:l,width:s-o,height:l-a}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};N(Rt,"Ratio",.6),N(Rt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let dr=Rt;const wu={value:{enumerable:!0,get:function(){return this._value},set:function(n){this._value=n,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(n){this._family=n,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(n){this._leading=n,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(n){this._alignment=n,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(n){this._style=n,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(n){this._weight=n,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(n){this._decoration=n,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(n){this._direction=n,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(n){this._baseline=n,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function V1(){this._flagFill=!0}function M1(){this._flagStroke=!0}const ti=class ti extends Mr{constructor(i,r,o,s){super(r,o,0,0);N(this,"_flagTextures",!1);N(this,"_flagFrameRate",!1);N(this,"_flagIndex",!1);N(this,"_amount",1);N(this,"_duration",0);N(this,"_index",0);N(this,"_startTime",0);N(this,"_playing",!1);N(this,"_firstFrame",0);N(this,"_lastFrame",0);N(this,"_loop",!0);N(this,"_textures",null);N(this,"_frameRate",0);N(this,"_origin",null);this._renderer.type="image-sequence";for(let a in xu)Object.defineProperty(this,a,xu[a]);this._renderer.flagTextures=I1.bind(this),this._renderer.bindTextures=A1.bind(this),this._renderer.unbindTextures=O1.bind(this),this.noStroke(),this.noFill(),Array.isArray(i)?this.textures=i.map(ku.bind(this)):typeof i=="string"&&(this.textures=[ku(i)]),this.origin=new ge,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=ti.DefaultFrameRate,this.index=0}static fromObject(i){const r=new ti().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ti.Properties.length;r++){const o=ti.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=We.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(i){const r=new ti(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="image-sequence",i.textures=this.textures.map(function(r){return r.toObject()}),i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let i=0;i<this.textures.length;i++){const r=this.textures[i];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const i=this._textures;let r,o,s,a,l,c,d,u;return i&&(this._flagTextures&&(this._amount=i.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,We.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=We.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?s=s%l:s=Math.min(s,l),d=jt(this._firstFrame,u,s/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o),this.fill=c,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Qe))&&(c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o)),this.fill=c)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};N(ti,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),N(ti,"DefaultFrameRate",30);let Ba=ti;const xu={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(n){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._textures=new Si((n||[]).slice(0)),this._textures.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}};function I1(){this._flagTextures=!0}function A1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function O1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function ku(n){if(n instanceof Qe)return n;if(typeof n=="string")return new Qe(n)}const Wi=class Wi extends Mr{constructor(i,r,o,s,a,l){super(r,o,0,0);N(this,"_flagTexture",!1);N(this,"_flagColumns",!1);N(this,"_flagRows",!1);N(this,"_flagFrameRate",!1);N(this,"_flagIndex",!1);N(this,"_amount",1);N(this,"_duration",0);N(this,"_startTime",0);N(this,"_playing",!1);N(this,"_firstFrame",0);N(this,"_lastFrame",0);N(this,"_loop",!0);N(this,"_texture",null);N(this,"_columns",1);N(this,"_rows",1);N(this,"_frameRate",0);N(this,"_index",0);N(this,"_origin",null);this._renderer.type="sprite";for(let c in Cu)Object.defineProperty(this,c,Cu[c]);this.noStroke(),this.noFill(),i instanceof Qe?this.texture=i:typeof i=="string"&&(this.texture=new Qe(i)),this.origin=new ge,this._update(),typeof s=="number"&&(this.columns=s),typeof a=="number"&&(this.rows=a),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(i){const r=new Wi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Wi.Properties.length;r++){const o=Wi.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=We.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(i){const r=new Wi(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&r.play(this._firstFrame,this._lastFrame),r.loop=this.loop,r.firstFrame=this.firstFrame,r.lastFrame=this.lastFrame,i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="sprite",i.texture=this.texture.toObject(),i.columns=this.columns,i.rows=this.rows,i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const i=this._texture,r=this._columns,o=this._rows;let s,a,l,c,d,u,f,h,p;if(i&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=i),i.loaded)){f=i.image.width,h=i.image.height,s=f/r,a=h/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(We.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=We.performance.now()-this._startTime,p=this._lastFrame+1,d=1e3*(p-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=jt(this._firstFrame,p,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%r,g=Math.floor(this._index/r),b=-s*m+(f-s)/2,y=-a*g+(h-a)/2;b!==i.offset.x&&(i.offset.x=b),y!==i.offset.y&&(i.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};N(Wi,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Na=Wi;const Cu={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(n){this._columns=n,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(n){this._rows=n,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}},qo=Math.min,Xo=Math.max,z1={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},zt=class zt extends En{constructor(i){super();N(this,"_flagAdditions",!1);N(this,"_flagSubtractions",!1);N(this,"_flagOrder",!1);N(this,"_flagOpacity",!0);N(this,"_flagBeginning",!1);N(this,"_flagEnding",!1);N(this,"_flagLength",!1);N(this,"_flagMask",!1);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_cap","round");N(this,"_join","round");N(this,"_miter",4);N(this,"_closed",!0);N(this,"_curved",!1);N(this,"_automatic",!0);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_length",0);N(this,"_mask",null);N(this,"_strokeAttenuation",!0);for(let r in vu)Object.defineProperty(this,r,vu[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(i)?i:Array.prototype.slice.call(arguments)}static InsertChildren(i){for(let r=0;r<i.length;r++)Su.call(this,i[r],this)}static RemoveChildren(i){for(let r=0;r<i.length;r++)Su.call(this,i[r])}static OrderChildren(i){this._flagOrder=!0}static fromObject(i){const r=new zt;for(let s=0;s<zt.Properties.length;s++){const a=zt.Properties[s];a in i&&(/(fill|stroke)/i.test(a)?r[a]=typeof i[a]=="string"?i[a]:Ni(i[a]):r[a]=i[a])}return"mask"in i&&(r.mask=o(i.mask)),"id"in i&&(r.id=i.id),r.children=i.children.map(o),r;function o(s){if(s&&s.renderer)switch(s.renderer.type){case"arc-segment":return pa.fromObject(s);case"circle":return ba.fromObject(s);case"element":return Vr.fromObject(s);case"ellipse":return xa.fromObject(s);case"group":return zt.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Ba.fromObject(s);case"path":return Ae.fromObject(s);case"points":return jo.fromObject(s);case"polygon":return ka.fromObject(s);case"rectangle":return Mr.fromObject(s);case"rounded-rectangle":return Ca.fromObject(s);case"shape":return En.fromObject(s);case"sprite":return Na.fromObject(s);case"star":return va.fromObject(s);case"text":return dr.fromObject(s)}return s}}static IsVisible(i,r){if(!r)return!0;let o=i;for(;o;){if(typeof o.visible=="boolean"&&!o.visible||typeof o.opacity=="number"&&o.opacity<=0)return!1;o=o.parent}return!0}static VisitForHitTest(i,r,o,s,a,l,c){const d=i&&i.children;if(!d)return!1;const u=r.results;for(let f=d.length-1;f>=0;f--){const h=d[f];if(!h||!zt.IsVisible(h,r.visibleOnly))continue;const p=typeof h.getBoundingClientRect=="function"?h.getBoundingClientRect():null;if(!(p&&!p1(p,r.x,r.y,l))){if(h instanceof zt){if(o&&(!s||s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c)||zt.VisitForHitTest(h,r,o,s,a,l,c))return!0;continue}if(h instanceof En&&!(s&&!s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c))return!0}}return!1}copy(i){super.copy.call(this,i),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<zt.Properties.length;r++){const o=zt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new zt,o=this.children.map(function(s){return s.clone()});return r.add(o),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="group",i.children=[],i.opacity=this.opacity,i.className=this.className,i.mask=this.mask?this.mask.toObject():null,We.each(this.children,(r,o)=>{i.children[o]=r.toObject()},this),i}dispose(){if(super.dispose(),this.children)for(let i=0;i<this.children.length;i++){const r=this.children[i];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(i,r,o){const s=o||{},{results:a,hitOptions:l,context:c,single:d,empty:u}=z1.getShapesAtPoint;a.length=0;const f=s.mode==="deepest"||s.deepest?"deepest":"all",h=s.visibleOnly!==!1,p=!!s.includeGroups,m=typeof s.filter=="function"?s.filter:null,g=typeof s.tolerance=="number"?s.tolerance:0;typeof s.precision=="number"?l.precision=s.precision:delete l.precision,typeof s.fill<"u"?l.fill=s.fill:delete l.fill,typeof s.stroke<"u"?l.stroke=s.stroke:delete l.stroke,l.tolerance=g,l.ignoreVisibility=!h;const b=f==="deepest";if(c.x=i,c.y=r,c.visibleOnly=h,c.results=a,zt.VisitForHitTest(this,c,p,m,l,g,b),b){if(a.length>0){const _=a[0];return a.length=0,d[0]=_,d.length=1,d}return u.length=0,u}const y=a.slice();return a.length=0,y}corner(){const i=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const o=this.children[r];o.translation.x-=i.left,o.translation.y-=i.top}return this.mask&&(this.mask.translation.x-=i.left,this.mask.translation.y-=i.top),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.children.length;s++){const a=this.children[s];a.isShape&&(a.translation.x-=r,a.translation.y-=o)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getById(i){let r=null;function o(s){if(s.id===i)return s;if(s.children){if(s.children.ids[i])return s.children.ids[i];for(let a=0;a<s.children.length;a++)if(r=o(s.children[a]),r)return r}return null}return o(this)}getByClassName(i){const r=[];function o(s){if(Array.prototype.indexOf.call(s.classList,i)>=0&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}getByType(i){const r=[];function o(s){if(s instanceof i&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}add(i){i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let r=0;r<i.length;r++){const o=i[r];if(!(o&&o.id))continue;const s=Array.prototype.indexOf.call(this.children,o);s>=0&&this.children.splice(s,1),this.children.push(o)}return this}remove(i){const r=arguments.length,o=this.parent;if(r<=0&&o)return o.remove(this),this;i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let s=0;s<i.length;s++){const a=i[s];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(i){let r,o,s,a,l,c;this._update(!0);let d=1/0,u=-1/0,f=1/0,h=-1/0;const p=/texture|gradient/i;o=i?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const g=this.children[m];if(!(!g.visible||p.test(g._renderer.type))&&(r=g.getBoundingClientRect(i),s=typeof r.top!="number"||We.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||We.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||We.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||We.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(i){const[b,y]=o.multiply(r.left,r.top),[_,k]=o.multiply(r.right,r.top),[x,v]=o.multiply(r.left,r.bottom),[B,w]=o.multiply(r.right,r.bottom);f=qo(y,k,v,w,f),d=qo(b,_,x,B,d),u=Xo(b,_,x,B,u),h=Xo(y,k,v,w,h)}else f=qo(r.top,f),d=qo(r.left,d),u=Xo(r.right,u),h=Xo(r.bottom,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}noFill(){return this.children.forEach(function(i){i.noFill()}),this}noStroke(){return this.children.forEach(function(i){i.noStroke()}),this}subdivide(){const i=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,i)}),this}_update(){let i,r,o;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=s*l,u=a*l;for(i=0;i<this.children.length;i++)o=this.children[i],r=o.length,d>c+r?(o.beginning=1,o.ending=1):u<c?(o.beginning=0,o.ending=0):d>c&&d<c+r?(o.beginning=(d-c)/r,o.ending=1):u>c&&u<c+r?(o.beginning=0,o.ending=(u-c)/r):(o.beginning=0,o.ending=1),c+=r}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};N(zt,"Children",du),N(zt,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let qn=zt;const vu={visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._flagVisible=this._visible!==n||this._flagVisible,this._visible=n}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._flagOpacity=this._opacity!==n||this._flagOpacity,this._opacity=n}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._flagBeginning=this._beginning!==n||this._flagBeginning,this._beginning=n}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._flagEnding=this._ending!==n||this._flagEnding,this._ending=n}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let n=0;n<this.children.length;n++){const e=this.children[n];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){this._fill=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=n}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){this._stroke=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=n}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=n}}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=n}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=n}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=n}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=n}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=n}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){this._automatic=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=n}}},children:{enumerable:!0,get:function(){return this._children},set:function(n){const e=qn.InsertChildren.bind(this),i=qn.RemoveChildren.bind(this),r=qn.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new du(n),this._children.bind(te.Types.insert,e),this._children.bind(te.Types.remove,i),this._children.bind(te.Types.order,r),n.length>0&&e(n)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=n)}}}};function Su(n,e){const i=n.parent;let r;if(i===e){o();return}if(i&&i.children.ids[n.id]&&(r=Array.prototype.indexOf.call(i.children,n),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete n.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,n),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,n),r>=0&&e.additions.splice(r,1)),n.parent=e,e.additions.push(n),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,n),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,n),r<0&&(i.subtractions.push(n),i._flagSubtractions=!0)}}class Yo extends Ae{constructor(e,i,r,o){const s=[new Ie(e,i),new Ie(r,o)];super(s);for(let a in Bu)Object.defineProperty(this,a,Bu[a]);this.vertices[0].command=fe.move,this.vertices[1].command=fe.line,this.automatic=!1}}N(Yo,"Properties",["left","right"]);const Bu={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(We.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=fe.move;else{const e=new Io("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(n){if(We.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=fe.line;else{const e=new Io("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Ta{constructor(e=0,i=0){this.x=e,this.y=i}}class Rn{constructor(e=10,i=0,r="A"){N(this,"start",new Ta);N(this,"end",new Ta);this.width=e,this.angle=i,this.label=r}}const Ye={line:{color:"#000",size:5},previewLine:{color:"#000",size:2},anchorPoint:{color:"#FF8000",size:12,strokeSize:20},lineLabel:{color:"#FF8000",size:22,rotation:-.5},angleLabel:{size:22,color:"#088c00",rotation:-.5},colorSideLabel:{size:20,color:"#439227"}},D1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function L1(n,e){return t.openBlock(),t.createElementBlock("svg",D1,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m289.94 256l95-95A24 24 0 0 0 351 127l-95 95l-95-95a24 24 0 0 0-34 34l95 95l-95 95a24 24 0 1 0 34 34l95-95l95 95a24 24 0 0 0 34-34Z"},null,-1)])])}const Uo=t.markRaw({name:"ion-close",render:L1}),H1={class:"mr-3 flex flex-col gap-2"},W1=["onClick"],j1={class:"h-full p-2"},q1={},X1=t.defineComponent({...q1,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(n,{emit:e}){const i=n,r=t.ref(!1),o=t.useTemplateRef("drawing-template-containers"),s=t.useTemplateRef("drawing-custom-template-containers"),a=e,l=c=>{r.value=!0,a("remove-custom-template",c,()=>{r.value=!1})};return t.onMounted(()=>{var c,d;(c=i.settings.templates)==null||c.forEach((u,f)=>{var p;const h=(p=o.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)}),(d=i.settings.customTemplates)==null||d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)})}),t.watch(()=>[...i.settings.customTemplates],(c,d)=>{t.nextTick(()=>{c.forEach((u,f)=>{var h;if(!(d!=null&&d.includes(u))){const p=(h=s.value)==null?void 0:h.at(f);p&&a("init-draw-template",p,u)}}),d.length>c.length&&d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&(h.innerHTML="",a("init-draw-template",h,u))})})},{deep:!0}),(c,d)=>{const u=Uo;return t.openBlock(),t.createBlock(t.unref(F.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:t.withCtx(()=>[t.createElementVNode("div",H1,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.settings.allTemplates,(f,h)=>(t.openBlock(),t.createElementBlock("div",{key:`${f.id}-${h}`,class:"group relative"},[t.createVNode(t.unref(F.NPopover),{trigger:"hover",placement:"right"},{trigger:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":h===n.selectTemplateIndex}]),onClick:p=>a("template:select",h)},[t.createElementVNode("div",j1,[t.createElementVNode("div",{ref_for:!0,ref:f.isCustom&&f.id!==-1?"drawing-custom-template-containers":"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,W1)]),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.label),1)]),_:2},1024),f.isCustom&&!f.isNewRec()?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,size:"tiny",quaternary:"",loading:r.value,disabled:r.value,circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:p=>l(h)},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):t.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Nu=fn(X1,[["__scopeId","data-v-afccb364"]]),Y1={class:"flex gap-3 min-w-[20rem] relative"},U1={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},K1={ref:"drawing-container",class:"size-full"},G1={},Tu=t.defineComponent({...G1,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select","remove-custom-template"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("drawing-container");let s=[],a=[],l=[],c=null;const d=.75,u=t.computed(()=>i.value.configuratorParams.linesAngles.map((W,D)=>new Rn(i.value.configuratorParams.linesWidths[D],W,`A-${D+1}`))),f=t.computed(()=>i.value.configuratorParams.colorSide==="bottom"),h=t.computed(()=>{var W,D;return i.value.configuratorParams.startTailType&&((W=i.settings.startTailConfigs)!=null&&W[i.value.configuratorParams.startTailType])?(D=i.settings.startTailConfigs)==null?void 0:D[i.value.configuratorParams.startTailType].points:[]}),p=t.computed(()=>{var D;const W=i.value.configuratorParams.endTailType!==void 0&&((D=i.settings.endTailConfigs)==null?void 0:D[i.value.configuratorParams.endTailType]);return!W||!W.points?[]:W.points.map((L,z)=>Array.isArray(L)?new Rn(L[0],L[1],`A-${z+1}`):new Rn(L.width,L.angle,`A-${z+1}`))}),m=(W,D=!1)=>{W[0].start.x=0,W[0].start.y=0;let L=0;for(let z=0;z<W.length;z++){const P=W[z],q=W[z-1]??new Rn(0,L);L+=!D||z>1?q.angle:0;const K=(!D||z>0?P.angle:0)+L;if(W[z].end.x=P.width*Math.cos(K*Math.PI/180)+W[z].start.x,W[z].end.y=P.width*Math.sin(K*Math.PI/180)+W[z].start.y,z<W.length-1){const J=z+1;W[J].start.x=W[z].end.x,W[J].start.y=W[z].end.y}}return W},g=(W,D,L,z,P=!1)=>{let q=m([...L,...z]);D.length>0&&(q=[...m(D),...q]);let K=0,J=0,Y=0,V=0;q.forEach(pe=>{K=Math.min(K,pe.start.x,pe.end.x),J=Math.min(J,pe.start.y,pe.end.y),Y=Math.max(Y,pe.start.x,pe.end.x),V=Math.max(V,pe.start.y,pe.end.y)});let A,ie;K===0&&J===0&&Y===0&&V===0?(A=1,ie=1):(A=W.width/Math.abs(Y-K),ie=(P?W.height:W.height-Ye.colorSideLabel.size)/Math.abs(V-J));const ce=Math.min(A,ie);return K=K<0?-K*ce:0,J=J<0?-J*ce:0,[ce,K,J]},b=W=>{const D=new jo([W]);return D._size=Ye.anchorPoint.size,D.fill=Ye.anchorPoint.color,D.stroke="transparent",D._linewidth=Ye.anchorPoint.strokeSize,l.push(D),D},y=(W,D)=>{if(l=[],i.settings.allowChangeFirstPoint){const L=W[0],z=new ge(L.vertices[0].x,L.vertices[0].y);z.bind(te.Types.change,()=>{L.vertices[0].copy(z)});const P=b(z);D.add(P)}W.forEach((L,z)=>{const P=W[z+1],q=new ge(L.vertices[1].x,L.vertices[1].y);q.bind(te.Types.change,()=>{L.vertices[1].copy(q),P!==void 0&&P.vertices[0].copy(q)});const K=b(q);D.add(K)})},_=W=>W*(Math.PI/180),k=(W,D,L)=>{const z=D.vertices.length-1;W.position.x=D.vertices[z].x,W.position.y=D.vertices[z].y;const P=Math.atan2(D.vertices[z].y-D.vertices[0].y,D.vertices[z].x-D.vertices[0].x);W.rotation=_(L)+P},x=(W,D,L)=>{if(D.vertices[0]===void 0)return;W.position.x=D.vertices[0].x,W.position.y=D.vertices[0].y;const z=D.vertices.length-1,P=Math.atan2(D.vertices[z].y-D.vertices[0].y,D.vertices[z].x-D.vertices[0].x);W.rotation=_(L)+P},v=(W,D,L)=>{const z=new qn;if(W.length===0)return z;const P=[];return[...W].reverse().forEach((q,K)=>{K!==0&&q.angle>0&&(q.angle*=-1),P.push(q)}),W=m(P,!0),x(z,D,W[0].angle),[D.vertices[0],D.vertices[1]].forEach(q=>{q.bind(te.Types.change,()=>{x(z,D,W[0].angle)})}),W.forEach(q=>{const K=q.start.x*L,J=q.end.x*L,Y=q.start.y*L,V=q.end.y*L,A=new Yo(K,Y,J,V);A.linewidth=Ye.line.size,A.stroke=Ye.line.color,z.add(A)}),z},B=(W,D,L)=>{const z=new qn;return W.length===0||(W=m(W,!0),k(z,D,W[0].angle),[D.vertices[0],D.vertices[1]].forEach(P=>{P.bind(te.Types.change,()=>{k(z,D,W[0].angle)})}),W.forEach(P=>{const q=P.start.x*L,K=P.end.x*L,J=P.start.y*L,Y=P.end.y*L,V=new Yo(q,J,K,Y);V.linewidth=Ye.line.size,V.stroke=Ye.line.color,z.add(V)})),z},w=(W,D,L,z)=>{const P=D.vertices[0].x+(D.vertices[1].x-D.vertices[0].x)/2-8*Math.sin(W.angle*Math.PI/180),q=D.vertices[0].y+(D.vertices[1].y-D.vertices[0].y)/2-8*Math.cos(W.angle*Math.PI/180),K=new dr(W.label,P+10,q-10);let J;K.size=Ye.lineLabel.size,K.weight=600,K.fill=Ye.lineLabel.color,K.id+=1,K.rotation=Ye.lineLabel.rotation,z>0&&(J=new dr(`${W.angle}°`,D.vertices[0].x+25,D.vertices[0].y-25),J.size=Ye.angleLabel.size,J.weight=600,J.fill=Ye.angleLabel.color,J.rotation=Ye.angleLabel.rotation,J.id+=z,s.push(J),L.add(J)),L.add(K),C(K,D,0,J),C(K,D,1)},T=()=>{const{size:W}=Ye.colorSideLabel,D=0,L=0,z=f.value?W/2:W/2-W,P=f.value?W/2-W:W/2,q=new qn;if(!c)return q;const K=5,J=Math.atan2(P-z,L-D),Y=[new Ie(D,z,0,0,0,0,Nn.Commands.move),new Ie(L,P,0,0,0,0,Nn.Commands.line),new Ie(L-K*Math.cos(J-Math.PI/4),P-K*Math.sin(J-Math.PI/4),0,0,0,0,Nn.Commands.line),new Ie(L,P,0,0,0,0,Nn.Commands.move),new Ie(L-K*Math.cos(J+Math.PI/4),P-K*Math.sin(J+Math.PI/4),0,0,0,0,Nn.Commands.line)],V=new Ae(Y,!1,!1,!0);V.noFill(),V.cap="round",V.join="round",V.linewidth=W/7,V.stroke=Ye.colorSideLabel.color,q.add(V);const A=new dr(f.value?"Цвет снизу":"Цвет сверху",10,0);A.size=W,A.weight=600,A.fill=Ye.colorSideLabel.color,A.alignment="left",q.add(A);const ie=q.getBoundingClientRect();return q.position.x=(c.width-ie.width)*d+10,q.position.y=f.value?c.height+ie.height*2:ie.height/2,q},C=(W,D,L,z)=>{D.vertices[L].bind(te.Types.change,()=>{const P=D.vertices.length-1,q=Math.atan2(D.vertices[0].y-D.vertices[P].y,D.vertices[0].x-D.vertices[P].x)*180/Math.PI,K=D.vertices[0].x+(D.vertices[P].x-D.vertices[0].x)/2-8*Math.sin(q*Math.PI/180),J=D.vertices[0].y+(D.vertices[P].y-D.vertices[0].y)/2-8*Math.cos(q*Math.PI/180);W.position.x=K+10,W.position.y=J-10,W.rotation=-.5,z&&(z.position.x=D.vertices[0].x+25,z.position.y=D.vertices[0].y-25)})},$=(W,D,L,z,P=!1)=>{var at;if(W.clear(),L.length===0){W.update();return}const q=m(L),[K,J,Y]=g(W,D,q,z,P),V=new qn,A=new Array,ie=new Array;P||(s=[],a=[]),q.forEach((we,ke)=>{const kt=we.start.x*K+J,Ne=we.end.x*K+J,Jt=we.start.y*K+Y,wn=we.end.y*K+Y,Pt=new Yo(kt,Jt,Ne,wn);Pt.linewidth=P?Ye.previewLine.size:Ye.line.size,Pt.stroke=P?Ye.previewLine.color:Ye.line.color,a.push(Pt),A.push(Pt),V.add(Pt),!P&&we.label!==""&&w(we,Pt,V,ke)});const ce=A.at(-1);let pe=V.getBoundingClientRect();if(!P){const we=T();ie.push(we)}if(D.length>0){const we=v(D,A[0],K);V.add(we)}if(z.length>0&&ce){const we=B(z,ce,K);V.add(we)}if(ie.push(V),W.makeGroup(ie),pe=V.getBoundingClientRect(),V.position.x=0-pe.left+(W.width-pe.width)/(2*(P?1:d)),V.position.y=0-pe.top+(W.height-pe.height)/(2*(P?1:d)),W.update(),!P){const we=((at=i.value.configuratorParams)==null?void 0:at.colorSide)==="top";V.position.y=V.position.y+Ye.colorSideLabel.size*Number(we),y(A,V),W.update()}},E=(W,D)=>{if(W&&!D.isNewRec()){const L=new Nn({width:W.scrollWidth,height:W.scrollHeight});L.appendTo(W),$(L,[],D.points,[],!0)}},I=()=>{c&&$(c,h.value,u.value,p.value,!1)},R=W=>W*(180/Math.PI),O=(W,D)=>{const L=W[1].x-W[0].x,z=W[1].y-W[0].y,P=D[1].x-D[0].x,q=D[1].y-D[0].y;let K=Math.atan2(L*q-z*P,L*P+z*q);return K=R(K),Math.round(K)*-1},U=W=>{const D=a.map((L,z,P)=>{const q=P[z-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Math.ceil(L._length/W/i.settings.lineWidthStep)*i.settings.lineWidthStep;const J=s[z-1];K<(P.length>1?i.settings.minLineWidth:i.settings.stripMinWidth)&&(K=P.length>1?i.settings.minLineWidth:i.settings.stripMinWidth),K>i.settings.maxLineWidth&&(K=i.settings.maxLineWidth);const Y=O(L.vertices,q.vertices);return J&&(J.value=`${Y}°`),new Rn(K,Y,`A-${z+1}`)});r("pointer:move",D)},Q=W=>{let D=null,L;const z=J=>{D=l.find(Y=>{const V=Y.renderer;return(V==null?void 0:V.elem)===J.target}),[L]=g(W,h.value,u.value.map(Y=>Y),p.value)},P=J=>{if(D){const Y=D.renderer,V=Y==null?void 0:Y.elem;if(!V)return;const A=V.getBoundingClientRect();D.vertices[0].x-=A.x-(J instanceof MouseEvent?J.clientX:J.targetTouches[0].clientX)+Ye.anchorPoint.size/2,D.vertices[0].y-=A.y-(J instanceof MouseEvent?J.clientY:J.targetTouches[0].clientY)+Ye.anchorPoint.size/2,U(L),W.update()}},q=()=>{D&&r("pointer:up",u.value),D=null},K=o.value;K&&(K.addEventListener("touchstart",z,{passive:!0}),K.addEventListener("touchend",q,{passive:!0}),K.addEventListener("mousedown",z),K.addEventListener("mouseup",q),K.addEventListener("mousemove",P),K.addEventListener("touchmove",P,{passive:!0}))},G=(W,D)=>{r("remove-custom-template",W,D)};return t.onMounted(()=>{o.value&&(c=new Nn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),t.watch(()=>i.value,()=>{I()},{deep:!0,immediate:!0}),Q(c))}),t.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(W,D)=>(t.openBlock(),t.createElementBlock("div",Y1,[t.createVNode(Nu,{"select-template-index":n.selectTemplateIndex,settings:n.settings,"onTemplate:select":D[0]||(D[0]=L=>r("template:select",L)),onInitDrawTemplate:E,onRemoveCustomTemplate:G},null,8,["select-template-index","settings"]),t.createElementVNode("div",U1,[t.createElementVNode("div",K1,null,512)])]))}});class ur extends j.Identity{constructor(i,r){super();N(this,"label","");N(this,"points",[]);N(this,"isCustom",!1);N(this,"id",-1);N(this,"guid","");i?(this.label=i.label,this.points=i.points.map((o,s)=>M.isArray(o)?new Rn(o[0],o[1],`A-${s+1}`):new Rn(o.width,o.angle,`A-${s+1}`)),this.isCustom=i.isCustom):(this.label="-- Новая конфигурация --",this.points=[new Rn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class $a extends ur{constructor(i){super(i);N(this,"isDefault");this.isDefault=i.isDefault??!1}}class $u{constructor(e){N(this,"minLineWidth");N(this,"maxLineWidth");N(this,"lineWidthStep");N(this,"minLineAngle");N(this,"maxLineAngle");N(this,"lineAngleStep");N(this,"stripMinWidth");N(this,"stripMaxWidth");N(this,"stripMinLength");N(this,"stripMaxLength");N(this,"allowShowTable");N(this,"showOnlyTemplates");N(this,"templates");N(this,"customTemplates",[]);N(this,"startTailConfigs");N(this,"endTailConfigs");N(this,"bendCountForExtended");N(this,"extendedProductCatalog");N(this,"allowChangeFirstPoint");N(this,"allowSaveTemplates");N(this,"userTemplatesPrefix");N(this,"lengthStep");N(this,"canSetDopProdaga");var i,r;this.minLineWidth=e.minLineWidth,this.maxLineWidth=e.maxLineWidth,this.lineWidthStep=e.lineWidthStep,this.minLineAngle=e.minLineAngle,this.maxLineAngle=e.maxLineAngle,this.lineAngleStep=e.lineAngleStep,this.stripMinWidth=e.stripMinWidth,this.stripMaxWidth=e.stripMaxWidth,this.stripMinLength=e.stripMinLength,this.stripMaxLength=e.stripMaxLength,this.allowShowTable=e.allowShowTable,this.showOnlyTemplates=e.showOnlyTemplates,this.templates=e.templates.map(o=>new ur(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((i=e.startTailConfigs)==null?void 0:i.map(o=>new $a(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new $a(o)))??[],this.bendCountForExtended=e.bendCountForExtended,this.extendedProductCatalog=e.extendedProductCatalog,this.allowChangeFirstPoint=e.allowChangeFirstPoint,this.allowSaveTemplates=e.allowSaveTemplates,this.userTemplatesPrefix=e.userTemplatesPrefix,this.lengthStep=e.lengthStep,this.canSetDopProdaga=e.canSetDopProdaga,this.showOnlyTemplates||(this.customTemplates=e.customTemplates?Object.entries(e.customTemplates).filter(([,o])=>o.id!==-1).map(([o,s])=>{const a=new ur(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new ur({label:"-- Новая конфигурация --",points:[new Rn(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findLast(o=>!o.isNewRec()),r=new ur(e);r.isCustom=!0,r.id=i?i.id+1:0,this.customTemplates.splice(-1,0,r)}removeCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findIndex(r=>r.id===e);i!==-1&&this.customTemplates.splice(i,1)}}const Z1={class:"flex flex-col gap-3"},Q1={class:"grid gap-5 md:grid-cols-5"},J1={},Eu=t.defineComponent({...J1,__name:"kozyrek-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.ref(new $u(i.settings)),d=t.ref({linesWidths:[...i.cartItem.configuratorParams.linesWidths],linesAngles:[...i.cartItem.configuratorParams.linesAngles]}),u=t.ref({quantity:{},marker:{},length:{}}),f=t.ref(0),h=t.useTemplateRef("kozyrek-configurator-params-form"),p=(C=0)=>{var E;const $=(E=c.value.allTemplates)==null?void 0:E.at(C);$!==void 0&&(f.value=C,l.value.configuratorParams.linesWidths=$.points.map(I=>M.isArray(I)?I[0]:I.width),l.value.configuratorParams.linesAngles=$.points.map(I=>M.isArray(I)?I[1]:I.angle),k()),y(l.value.configuratorParams)},m=async()=>{const C=prompt("Введите название шаблона:");if(!C)return;a.value=!0;const $={label:C,points:l.value.configuratorParams.linesWidths.map((I,R)=>[I,l.value.configuratorParams.linesAngles[R]])},E=I=>{I&&(c.value.addCustomTemplate($),f.value=c.value.allTemplates.length-2),a.value=!1};i.eventEmitter.emit("configurator:create-template",{category:i.cartItem.category,template:$,callback:E})},g=async(C,$)=>{var R;const E=(R=c.value.allTemplates)==null?void 0:R.at(C);if(!E||!E.isCustom)return;const I=O=>{O&&(c.value.removeCustomTemplate(E.id),p()),$==null||$()};i.eventEmitter.emit("configurator:remove-template",{category:i.cartItem.category,templateId:E.id,callback:I})},b=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(f.value=c.value.allTemplates.length-1)},y=async C=>{var $,E;l.value.product=new j.ClientProduct,(E=($=h.value)==null?void 0:$.formReference)==null||E.validate(I=>{I||(k(),o.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:C,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(M.noop)},_=async()=>{var C,$;($=(C=h.value)==null?void 0:C.formReference)==null||$.validate(E=>{var I,R;if(!E){s.value=!0;const O=new j.OrderItemBase(l.value);(I=c.value.startTailConfigs)!=null&&I.length||delete O.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete O.configuratorParams.endTailType,r("submit",O,u.value,()=>{s.value=!1,t.nextTick(()=>{var U,Q;(Q=(U=h.value)==null?void 0:U.formReference)==null||Q.restoreValidation()})})}}).catch(M.noop)},k=()=>{const C={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach(($,E)=>{C[`lines_widths[${E+1}]`]={},C[`lines_angles[${E+1}]`]={}}),u.value=C},x=C=>{d.value.linesWidths=C.map($=>$.width),d.value.linesAngles=C.map($=>$.angle)},v=C=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,k(),b(),y(l.value.configuratorParams)},B=(C,$)=>{d.value.linesWidths=C,d.value.linesAngles=$},w=C=>{const $=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,E=0;l.value.configuratorParams.linesWidths.splice(C+1,0,$),l.value.configuratorParams.linesAngles.splice(C+1,0,E),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),b(),y(l.value.configuratorParams)},T=C=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(C,1),l.value.configuratorParams.linesAngles.splice(C,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),b(),y(l.value.configuratorParams))};return t.onMounted(()=>{i.cartItem.isNewRec()?p():(k(),f.value=-1,y(l.value.configuratorParams))}),t.watch(()=>i.cartItem,C=>{l.value=new j.OrderItemBase(C),C.isNewRec()?p():(k(),f.value=-1,y(l.value.configuratorParams))}),(C,$)=>{const E=F.NButton;return t.openBlock(),t.createElementBlock("div",Z1,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(E,{key:0,type:"tertiary",class:"self-end",onClick:$[0]||($[0]=I=>r("click:view-switch"))},{default:t.withCtx(()=>[...$[3]||($[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",Q1,[t.createVNode(Tu,{value:l.value,"select-template-index":f.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":v,"onPointer:move":x,"onTemplate:select":p,onRemoveCustomTemplate:g},null,8,["value","select-template-index","settings"]),t.createVNode(lc,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":$[1]||($[1]=I=>l.value=I),"preview-params":d.value,validation:u.value,settings:c.value,"is-submit-processing":s.value,"is-product-searching":o.value,"select-template-index":f.value,class:"col-span-2","onUpdate:params":$[2]||($[2]=I=>y(I)),"onUpdate:preview":B,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":w,"onClick:removeLine":T},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),eb={class:"flex flex-col items-center justify-between rounded-xl"},tb={class:"img-preview relative flex justify-center"},nb={},ib=t.defineComponent({...nb,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(n,{emit:e}){const i=n,r=t.computed(()=>{const{height:s}=i.configuratorParams;return M.keys(i.settings.crossbarCount).reverse().find(a=>s>=i.settings.crossbarCount[Number(a)])}),o=e;return(s,a)=>{const l=F.NButton;return t.openBlock(),t.createElementBlock("div",eb,[t.createElementVNode("div",tb,[a[1]||(a[1]=t.createElementVNode("div",{class:"window"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["net",`net-${n.configuratorParams.netType}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["frame",`frame-${n.configuratorParams.color}`])},null,2),r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${n.configuratorParams.color}`])},null,2)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["mount",`mount-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["cut-preview",`cut-preview-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2)]),t.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>o("open-instructions"))},{default:t.withCtx(()=>[...a[2]||(a[2]=[t.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),Ea=fn(ib,[["__scopeId","data-v-2a790a20"]]),rb={key:0,class:"flex items-baseline gap-1"},ob={key:0,class:"flex items-baseline gap-1"},sb={key:1},ab={class:"text-lg font-semibold"},lb={key:2,class:"text-red-500 text-sm mb-2"},cb={class:"flex gap-3"},db={},Ru=t.defineComponent({...db,__name:"mosquito-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:instructions-toggle","click:show-preview-drawer"],setup(n,{expose:e,emit:i}){var w;const r=n,o=i,s=t.computed(()=>Xe.isPhoneDevice()),a=t.useTemplateRef("form-reference"),l=t.useTemplateRef("width-form-item-reference"),c=t.useTemplateRef("height-form-item-reference"),d=t.useTemplateRef("width-input-reference"),u=t.ref(M.cloneDeep(r.value)),f=t.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),h=t.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),p=t.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),m=t.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),g=t.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+f.value:0),b=t.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+h.value:0),y=t.ref(r.settings.canSetDopProdaga??!1),_=t.computed(()=>({"configuratorParams.width":[le.required,le.min(r.settings.minWidth-f.value),le.max(p.value-f.value),le.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[le.required,le.min(r.settings.minHeight-h.value),le.max(m.value-h.value),le.step(1),He.serverValidation(r.validation.height.feedback)],quantity:[le.required,le.min(1),le.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),k=t.computed(()=>{var R;const T=g.value,C=b.value,{quantity:$}=r.value,E=((R=r.value.product)==null?void 0:R.costRub)||0;if(!T||!C||!$||E===0)return null;const I=T*C/1e6;return(E*$*I).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=t.computed(()=>{const T=g.value,C=b.value,$=!!(T&&T>=r.settings.minWidth&&T<=r.settings.maxWidths[u.value.configuratorParams.netType]),E=!!(C&&C>=r.settings.minHeight&&C<=r.settings.maxHeights[u.value.configuratorParams.netType]),I=!!(r.value.quantity&&r.value.quantity>0);return $&&E&&I}),v=(T,C)=>{var I,R;const $=u.value.configuratorParams;T&&T in $&&($[T]=C);const E={...$,width:g.value??0,height:b.value??0};T==="width"&&((I=l.value)==null||I.validate().catch(M.noop)),T==="height"&&((R=c.value)==null||R.validate().catch(M.noop)),t.nextTick(()=>{var U,Q;!((U=l.value)!=null&&U.validationErrored)&&!((Q=c.value)!=null&&Q.validationErrored)&&E.height&&E.width&&o("update:params",E),B("configuratorParams",E)})},B=(T,C)=>{const $=new j.OrderItemBase(r.value);$[T]=C,T==="configuratorParams"&&($.product=new j.ClientProduct),o("update:value",$)};return t.watch(()=>r.value,T=>{const C=M.cloneDeep(t.toRaw(T)),$=C.configuratorParams.mountType,E=r.settings.widthOverlaps[$]??0,I=r.settings.heightOverlaps[$]??0;C.configuratorParams.width&&C.configuratorParams.width>0&&(C.configuratorParams.width-=E),C.configuratorParams.height&&C.configuratorParams.height>0&&(C.configuratorParams.height-=I),u.value=C},{deep:!0,immediate:!0}),t.onMounted(()=>{var T;(T=d.value)==null||T.select()}),e({validate:(w=a.value)==null?void 0:w.validate,formReference:a}),(T,C)=>{const $=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:u.value,rules:_.value,class:"flex flex-col gap-2 px-4 md:max-w-96 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[C[0]||(C[0]=E=>u.value.configuratorParams.netType=E),C[1]||(C[1]=E=>v("netType",E))],options:n.settings.netType.map(E=>({label:n.settings.descriptions.net_type[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[C[2]||(C[2]=E=>u.value.configuratorParams.color=E),C[3]||(C[3]=E=>v("color",E))],options:n.settings.color.map(E=>({label:n.settings.descriptions.color[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[C[4]||(C[4]=E=>u.value.configuratorParams.mountType=E),C[5]||(C[5]=E=>v("mountType",E))],options:n.settings.mountType.map(E=>({label:n.settings.descriptions.mount_type[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{ref:"width-form-item-reference",path:"configuratorParams.width",label:`Ширина светового проёма от ${n.settings.minWidth-f.value} ${p.value?" до "+(p.value-f.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.width.showFeedback&&g.value>=n.settings.minWidth&&g.value<=n.settings.maxWidths[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",rb,[t.createVNode(t.unref(F.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Ширина готового изделия "+t.toDisplayString(g.value),1)]),_:1}),t.createVNode(t.unref(F.NButton),{quaternary:"",type:"info",size:"tiny",onClick:C[10]||(C[10]=E=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...C[25]||(C[25]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[C[6]||(C[6]=E=>u.value.configuratorParams.width=E),C[9]||(C[9]=E=>v("width",E))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:C[7]||(C[7]=E=>t.unref(lt)(E)),onInput:C[8]||(C[8]=E=>t.unref(ot)(n.validation,"width")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${n.settings.minHeight-h.value} ${m.value?" до "+(m.value-h.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.height.showFeedback&&b.value>=n.settings.minHeight&&b.value<=n.settings.maxHeights[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",ob,[t.createVNode(t.unref(F.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Высота готового изделия "+t.toDisplayString(b.value),1)]),_:1}),t.createVNode(t.unref(F.NButton),{quaternary:"",type:"info",size:"tiny",onClick:C[15]||(C[15]=E=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...C[26]||(C[26]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[C[11]||(C[11]=E=>u.value.configuratorParams.height=E),C[14]||(C[14]=E=>v("height",E))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:C[12]||(C[12]=E=>t.unref(lt)(E)),onInput:C[13]||(C[13]=E=>t.unref(ot)(n.validation,"height")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:u.value.quantity,"onUpdate:value":[C[16]||(C[16]=E=>u.value.quantity=E),C[19]||(C[19]=E=>B("quantity",E??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:C[17]||(C[17]=E=>t.unref(lt)(E,!1)),onInput:C[18]||(C[18]=E=>t.unref(ot)(n.validation,"quantity")),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:C[20]||(C[20]=E=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":C[21]||(C[21]=E=>{u.value.marker=E??null,B("marker",E??null)}),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),y.value?(t.openBlock(),t.createBlock($,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":C[22]||(C[22]=E=>{u.value.isAdditionalSale=E??!1,B("isAdditionalSale",E??!1)})},{default:t.withCtx(()=>[...C[27]||(C[27]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode($r,{"is-product-searching":n.isProductSearching,product:u.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),k.value?(t.openBlock(),t.createElementBlock("div",sb,[C[28]||(C[28]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",ab,t.toDisplayString(k.value)+" ₽",1)])):t.createCommentVNode("",!0),x.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",lb," Пожалуйста, заполните все обязательные поля корректно. ")),t.createElementVNode("div",cb,[t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:C[23]||(C[23]=E=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,type:"default",onClick:C[24]||(C[24]=E=>o("click:show-preview-drawer"))},{default:t.withCtx(()=>[...C[29]||(C[29]=[t.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):t.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",u.value)]])}}}),ub="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",fb="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",hb="/img/configurators/mosquitto/measurement-instructions/mount.png",mb="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",pb="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",gb={class:"flex flex-col gap-6"},yb={class:"flex gap-4"},bb={class:"flex flex-col gap-2"},_b={class:"flex gap-4"},wb={class:"flex flex-col gap-2"},xb={class:"flex gap-4"},kb={class:"flex flex-col gap-2"},Cb={},Pu=t.defineComponent({...Cb,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(n,{emit:e}){const i=Xe.initRefDependingOnDeviceResolution("small","small","medium"),r=Xe.initRefDependingOnDeviceResolution(.98,.95,.8),o=t.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=F.NText;return t.openBlock(),t.createBlock(t.unref(F.NModal),{show:n.show,"show-icon":!1,size:t.unref(i),style:t.normalizeStyle(`width: ${o.value}px`),title:"Руководство по замеру","action-class":"grid grid-cols-2 !justify-between",preset:"dialog",onClose:l[0]||(l[0]=d=>s("update:show",!1)),onEsc:l[1]||(l[1]=d=>s("update:show",!1)),onMaskClick:l[2]||(l[2]=d=>s("update:show",!1))},{default:t.withCtx(()=>[t.createElementVNode("div",gb,[t.createVNode(c,{type:"error",class:"text-base font-medium"},{default:t.withCtx(()=>[...l[3]||(l[3]=[t.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=t.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:ub,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),t.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:fb,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),t.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),t.createElementVNode("div",yb,[l[9]||(l[9]=t.createElementVNode("img",{src:hb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",bb,[l[8]||(l[8]=t.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),t.createElementVNode("span",null,[l[4]||(l[4]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.frame)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=t.createElementVNode("br",null,null,-1)),l[7]||(l[7]=t.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),t.createElementVNode("div",_b,[l[15]||(l[15]=t.createElementVNode("img",{src:mb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",wb,[l[14]||(l[14]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),t.createElementVNode("span",null,[l[10]||(l[10]=t.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=t.createElementVNode("br",null,null,-1)),l[13]||(l[13]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),t.createElementVNode("div",xb,[l[21]||(l[21]=t.createElementVNode("img",{src:pb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",kb,[l[20]||(l[20]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),t.createElementVNode("span",null,[l[16]||(l[16]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_metal)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=t.createElementVNode("br",null,null,-1)),l[19]||(l[19]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),vb={class:"grid md:grid-cols-2"},Sb={},Fu=t.defineComponent({...Sb,__name:"mosquito-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>Xe.isPhoneDevice()),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.useTemplateRef("mosquito-configurator-form"),d=t.ref({width:{},height:{},quantity:{},marker:{}}),u=t.ref(!1),f=t.ref(!1),h=t.computed(()=>t.inject("debounce-input-time",300)),p=M.debounce(async g=>{var b,y;l.value.product=new j.ClientProduct,(y=(b=c.value)==null?void 0:b.formReference)==null||y.validate(_=>{_||(u.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:g,validationFieldResultData:d.value,callback:k=>{k?l.value.product=k:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(M.noop)},h.value),m=()=>{f.value=!0,r("submit",l.value,d.value,()=>{f.value=!1})};return t.watch(()=>i.cartItem,g=>{l.value=g},{deep:!0}),(g,b)=>{const y=Uo;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(Pu,{show:a.value,"onUpdate:show":b[0]||(b[0]=_=>a.value=_),"height-overlaps":n.settings.heightOverlaps,"width-overlaps":n.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),t.createElementVNode("div",vb,[o.value?(t.openBlock(),t.createBlock(t.unref(F.NDrawer),{key:1,show:s.value,"onUpdate:show":b[4]||(b[4]=_=>s.value=_),"default-width":375,resizable:""},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NDrawerContent),null,{header:t.withCtx(()=>[t.createVNode(t.unref(F.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:b[2]||(b[2]=_=>s.value=!1)},{default:t.withCtx(()=>[t.createVNode(y)]),_:1})]),default:t.withCtx(()=>[t.createVNode(Ea,{"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[3]||(b[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(t.openBlock(),t.createBlock(Ea,{key:0,"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[1]||(b[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),t.createVNode(Ru,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":b[5]||(b[5]=_=>l.value=_),validation:d.value,settings:n.settings,"is-product-searching":u.value,"is-submit-processing":f.value,"onUpdate:params":b[6]||(b[6]=_=>t.unref(p)(_)),onSubmit:b[7]||(b[7]=_=>m()),"onClick:instructionsToggle":b[8]||(b[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":b[9]||(b[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),Bb={},Vu=t.defineComponent({...Bb,__name:"strip-configurator-line-item",props:{value:{},index:{},path:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},isLastLine:{type:Boolean,default:!1},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useTemplateRef("width-input-element"),a=t.ref(!1),l=t.ref(r.value),c=t.useTemplateRef("form-item-reference"),d=t.computed(()=>{var p;return!((p=c.value)!=null&&p.validationErrored)}),u=p=>{l.value=p,o("update:value",p,r.index,a)},f=p=>{lt(p),(p.key==="Enter"||p.code==="Enter")&&!r.isLastLine&&(p.preventDefault(),p.stopPropagation())},h=()=>{var p;(p=s.value)==null||p.select()};return t.watch(()=>r.value,p=>{l.value=p}),t.onMounted(()=>{r.autoFocus&&t.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(p,m)=>{const g=ac,b=fo;return t.openBlock(),t.createBlock(t.unref(F.NFormItem),{ref:"form-item-reference",path:n.path,label:`Полоса №${n.index+1}, мм`,class:"sc-hide-empty-feedback-message"},{feedback:t.withCtx(()=>[d.value?(t.openBlock(),t.createBlock($r,{key:0,"is-product-searching":a.value,product:n.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NDropdown),{trigger:"click",options:n.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:t.unref(ct),placeholder:"Введите ширину",onKeydown:f,onInput:m[0]||(m[0]=y=>t.unref(ot)(n.validation,`linesWidths.${n.index}`)),onFocus:t.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),t.createVNode(t.unref(F.NButton),{disabled:n.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[1]||(m[1]=y=>o("click:add-line",n.index))},{default:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["disabled"]),t.createVNode(t.unref(F.NButton),{disabled:n.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[2]||(m[2]=y=>o("click:remove-line",n.index))},{default:t.withCtx(()=>[t.createVNode(b)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),Nb={class:"my-2 flex w-full flex-col"},Tb={key:1},$b={class:"text-lg font-semibold"},Eb={class:"flex gap-3"},Rb={},Mu=t.defineComponent({...Rb,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){var _;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("line-items-reference"),l=t.ref(M.cloneDeep(r.value)),c=t.computed(()=>{const k={length:[le.required,le.min(r.settings.minLength),le.max(r.settings.maxLength),le.step(r.settings.lengthStep),He.serverValidation(r.validation.length.feedback)],quantity:[le.required,le.min(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]};return M.forEach(l.value,(x,v)=>{var B;k[`configuratorParams.linesWidths.${v}`]=[le.required,le.min(r.settings.minLineWidth),le.step(r.settings.lineWidthStep),He.serverValidation((B=r.validation[`linesWidths.${v}`])==null?void 0:B.feedback)]}),k}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((k,x)=>(k??0)+(x??0),0)),f=t.computed(()=>r.settings.width-u.value),h=t.computed(()=>!r.value.some(({product:k})=>!k||k.isNewRec())),p=t.computed(()=>r.isSubmitProcessing||!h.value||f.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(k=>k.product.isNewRec())),m=t.computed(()=>k=>f.value===0?void 0:[{label:`${(f.value>0?"Остаток +":"Излишек ")+f.value} мм.`,key:f.value+k}]),g=t.computed(()=>{const{length:k}=r.value[0];return!k||u.value!==r.settings.width?null:(M.reduce(r.value,(v,B)=>{var T;const w=((T=B.product)==null?void 0:T.costRub)||0;return v+w},0)*r.value[0].quantity*k).toLocaleString("ru-ru",{minimumFractionDigits:2})}),b=(k,x,v)=>{var w,T,C;l.value[x].product.id=-1;const{configuratorParams:B}=l.value[x];B.linesWidths[x]=k,y("configuratorParams",B),(C=(T=(w=a.value)==null?void 0:w.at(x))==null?void 0:T.formItemReference)==null||C.validate().catch(M.noop),t.nextTick(()=>{var $,E;(E=($=a.value)==null?void 0:$.at(x))!=null&&E.isValid&&o("update:params",B,x,v)})},y=(k,x)=>{l.value.forEach(v=>{v[k]=x}),o("update:value",l.value)};return t.watch(()=>r.value,k=>{l.value=M.cloneDeep(k)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(k,x)=>{const v=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:l.value[0],rules:c.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var B;return[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(w,T)=>{var C,$,E;return t.openBlock(),t.createBlock(Vu,{key:T,ref_for:!0,ref:"line-items-reference",value:((C=w.configuratorParams)==null?void 0:C.linesWidths.at(T))??null,"auto-focus":((($=w.configuratorParams)==null?void 0:$.linesWidths.at(T))??0)===0,index:T,path:`configuratorParams.linesWidths.${T}`,product:w.product,settings:n.settings,validation:n.validation,"suggestion-option":m.value(((E=w.configuratorParams)==null?void 0:E.linesWidths.at(T))??0),"add-line-button-disabled":f.value<=0||n.value.length>=n.settings.maxLinesCount||n.value.some(I=>I.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":T===l.value.length-1&&f.value===0,"onUpdate:value":b,"onClick:addLine":x[0]||(x[0]=I=>o("click:add-line",I)),"onClick:removeLine":x[1]||(x[1]=I=>o("click:remove-line",I))},null,8,["value","auto-focus","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled","is-last-line"])}),128)),t.createElementVNode("div",Nb,[f.value<0?(t.openBlock(),t.createBlock(t.unref(F.NText),{key:0,type:"error"},{default:t.withCtx(()=>[t.createTextVNode(" Сумма ширин всех полос должна быть равна "+t.toDisplayString(n.settings.width),1)]),_:1})):t.createCommentVNode("",!0),h.value&&l.value.length===n.settings.maxLinesCount&&f.value>0?(t.openBlock(),t.createBlock(t.unref(F.NText),{key:1,type:"error"},{default:t.withCtx(()=>[...x[15]||(x[15]=[t.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",null,[x[16]||(x[16]=t.createTextVNode(" Остаток для резки: ",-1)),t.createVNode(t.unref(F.NText),{type:f.value>=0?"Success":"error"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.value),1)]),_:1},8,["type"]),t.createTextVNode(" из "+t.toDisplayString(n.settings.width)+" мм ",1)])]),t.createVNode(t.unref(F.NButton),{disabled:p.value,type:"primary",class:"self-center",onClick:x[2]||(x[2]=w=>o("click:add-line",l.value.length))},{default:t.withCtx(()=>[...x[17]||(x[17]=[t.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),t.createVNode(t.unref(F.NFormItem),{path:"length",label:`Метраж ${n.settings.minLength?" от "+n.settings.minLength:""} ${n.settings.maxLength?" до "+n.settings.maxLength:""} м.`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value[0].length,"onUpdate:value":[x[3]||(x[3]=w=>l.value[0].length=w),x[6]||(x[6]=w=>y("length",w))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=w=>t.unref(lt)(w,!1)),onInput:x[5]||(x[5]=w=>t.unref(ot)(n.validation,"length")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[x[7]||(x[7]=w=>l.value[0].quantity=w),x[10]||(x[10]=w=>y("quantity",w))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=w=>t.unref(lt)(w,!1)),onInput:x[9]||(x[9]=w=>t.unref(ot)(n.validation,"quantity")),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:x[11]||(x[11]=w=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":x[12]||(x[12]=w=>{l.value[0].marker=w??null,y("marker",w??null)}),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(v,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=w=>{l.value[0].isAdditionalSale=w??!1,y("isAdditionalSale",w??!1)})},{default:t.withCtx(()=>[...x[18]||(x[18]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createElementBlock("div",Tb,[x[19]||(x[19]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",$b,t.toDisplayString(g.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Eb,[t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:!h.value||f.value!=0||!((B=l.value[0])!=null&&B.length)||l.value[0].length>n.settings.maxLength||l.value[0].length<n.settings.minLength||l.value[0].quantity===0,type:"primary",class:"self-start",onClick:x[14]||(x[14]=w=>o("submit",l.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",l.value)]])}}}),Pb={class:"flex grow flex-col"},Fb=["src"],Vb={class:"w-full"},Mb={},Iu=t.defineComponent({...Mb,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",Pb,[t.createElementVNode("img",{src:"/img/configurators/strip/strip-"+n.value.length+".png",class:"w-full max-w-96 self-center py-5",alt:"Штрипс"},null,8,Fb),t.createElementVNode("div",Vb,[t.createTextVNode(" Число полос можно указать от "+t.toDisplayString(n.settings.minLinesCount)+" до "+t.toDisplayString(n.settings.maxLinesCount)+". ",1),i[0]||(i[0]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Минимальная ширина полосы "+t.toDisplayString(n.settings.minLineWidth)+" мм. ",1),i[1]||(i[1]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина всех полос "+t.toDisplayString(n.settings.width)+" мм. ",1),i[2]||(i[2]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Шаг ширины полосы - "+t.toDisplayString(n.settings.lineWidthStep)+" мм. ",1)])]))}}),Ib={class:"flex flex-col gap-2"},Ab={class:"flex grow flex-col px-5 md:w-104"},Ob={},Au=t.defineComponent({...Ob,__name:"strip-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("strip-configurator-form"),s=t.ref(i.cartItems),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.computed(()=>t.inject("debounce-input-time",300)),d=t.computed(()=>{var m;return(m=s.value[0].configuratorParams)==null?void 0:m.linesWidths.reduce((g,b)=>(g??0)+(b??0),0)}),u=m=>{m===void 0&&(m=s.value.length-1);const g=s.value.at(0);if(!g)return;g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(y=>{y.configuratorParams.linesWidths=g.configuratorParams.linesWidths});const b=new j.OrderItemBase({quantity:(g==null?void 0:g.quantity)??1,category:g==null?void 0:g.category,length:(g==null?void 0:g.length)??i.settings.minLength,marker:g==null?void 0:g.marker,configuratorParams:{linesWidths:g==null?void 0:g.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,b)},f=m=>{const g=s.value.at(0);g&&(g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(b=>{b.configuratorParams.linesWidths=g.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete a[`linesWidths.${m}`],delete a[`linesWidths.${m}`])},h=M.debounce(async(m,g,b)=>{const y={linesWidths:m.linesWidths.at(g)};b.value=!0,a.value[`linesWidths.${g}`]={},s.value[g].product=new j.ClientProduct,i.eventEmitter.emit("configurator:search-product",{category:s.value[g].category,params:y,validationFieldResultData:a.value,callback:_=>{_?(s.value[g].product=_,g===s.value.length-1&&s.value.length<i.settings.maxLinesCount&&d.value&&d.value<i.settings.width&&u()):(s.value[g].product=new j.ClientProduct,a.value[`linesWidths.${g}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},b.value=!1),b.value=!1}})},c.value),p=async()=>{var m,g;(g=(m=o.value)==null?void 0:m.formReference)==null||g.validate(b=>{if(!b){l.value=!0;const y=s.value.at(0);if(!y)return;r("submit",y,a.value,()=>{l.value=!1,t.nextTick(()=>{var _,k;(k=(_=o.value)==null?void 0:_.formReference)==null||k.restoreValidation()})})}}).catch(M.noop)};return t.watch(()=>i.cartItems,m=>{s.value=m.map(g=>new j.OrderItemBase(g))}),(m,g)=>{const b=F.NButton;return t.openBlock(),t.createElementBlock("div",Ib,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(b,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=y=>r("click:view-switch"))},{default:t.withCtx(()=>[...g[3]||(g[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",Ab,[t.createVNode(Iu,{value:s.value,"onUpdate:value":g[1]||(g[1]=y=>s.value=y),settings:n.settings},null,8,["value","settings"]),t.createVNode(Mu,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":g[2]||(g[2]=y=>s.value=y),validation:a.value,settings:n.settings,"is-submit-processing":l.value,"onUpdate:params":t.unref(h),onSubmit:p,"onClick:addLine":u,"onClick:removeLine":f},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),zb={class:"flex flex-col gap-3"},Db={},Ou=t.defineComponent({...Db,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit"],setup(n,{expose:e,emit:i}){var p;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("first-input-element"),l=t.ref(M.cloneDeep(r.value)),c=t.computed(()=>({"configuratorParams.width":[le.required,le.min(r.settings.minWidth),...r.settings.maxWidth?[le.max(r.settings.maxWidth)]:[],le.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[le.required,le.min(r.settings.minLength),le.max(r.settings.maxLength),le.step(1),He.serverValidation(r.validation.length.feedback)],quantity:[le.required,le.min(1),le.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),d=t.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),f("configuratorParams",l.value.configuratorParams)},f=(m,g)=>{const b=new j.OrderItemBase(r.value);b[m]=g,m==="configuratorParams"&&(b.product=new j.ClientProduct),o("update:value",b)},h=()=>{var m;(m=a.value)==null||m.select()};return t.watch(()=>r.value,m=>{l.value=M.cloneDeep(m)},{deep:!0}),t.onMounted(()=>{r.value.isNewRec()&&t.nextTick(()=>{h()})}),e({validate:(p=s.value)==null?void 0:p.validate,formReference:s}),(m,g)=>{const b=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:l.value,rules:c.value,disabled:n.isSubmitProcessing,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${n.settings.minWidth?" от "+n.settings.minWidth:""}${n.settings.maxWidth?" до "+n.settings.maxWidth:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[g[0]||(g[0]=y=>l.value.configuratorParams.width=y),u],class:"w-full",parse:t.unref(ct),"show-button":!1,placeholder:"Введите ширину",onKeydown:g[1]||(g[1]=y=>t.unref(lt)(y)),onInput:g[2]||(g[2]=y=>t.unref(ot)(n.validation,"width")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"configuratorParams.length",label:`Длина, ${n.settings.minLength?" от "+n.settings.minLength:""}${n.settings.maxLength?" до "+n.settings.maxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[g[3]||(g[3]=y=>l.value.configuratorParams.length=y),u],placeholder:"Введите длину",parse:t.unref(ct),"show-button":!1,class:"w-full",onKeydown:g[4]||(g[4]=y=>t.unref(lt)(y)),onInput:g[5]||(g[5]=y=>t.unref(ot)(n.validation,"length")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:n.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:g[6]||(g[6]=y=>t.unref(lt)(y,!1)),onInput:g[7]||(g[7]=y=>t.unref(ot)(n.validation,"quantity")),"onUpdate:value":g[8]||(g[8]=y=>f("quantity",y??0)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:n.value.marker??null,placeholder:"Введите маркировку",onInput:g[9]||(g[9]=y=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":g[10]||(g[10]=y=>f("marker",y??null)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(b,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":g[11]||(g[11]=y=>{l.value.isAdditionalSale=y??!1,f("isAdditionalSale",y??!1)})},{default:t.withCtx(()=>[...g[13]||(g[13]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode($r,{"is-product-searching":n.isProductSearching,product:n.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),t.createElementVNode("div",zb,[t.createVNode(t.unref(F.NButton),{disabled:n.value.product.isNewRec()||n.isProductSearching||n.isSubmitProcessing||n.value.length===0||n.value.width===0||n.value.quantity===0,type:"primary",class:"self-start",onClick:g[12]||(g[12]=y=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])),[[t.unref(oi),()=>o("submit",l.value)]])}}}),Lb={class:"flex flex-col gap-2 w-72"},Hb={},zu=t.defineComponent({...Hb,__name:"metal-for-doors-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("metal-for-doors-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.ref(!1),d=t.computed(()=>t.inject("debounce-input-time",300)),u=M.debounce(async h=>{var p,m;s.value.product=new j.ClientProduct,(m=(p=o.value)==null?void 0:p.formReference)==null||m.validate(g=>{g||(l.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:h,validationFieldResultData:a.value,callback:b=>{b?s.value.product=b:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(M.noop)},d.value),f=async()=>{var h,p;(p=(h=o.value)==null?void 0:h.formReference)==null||p.validate(m=>{m||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})}))}).catch(M.noop)};return t.watch(()=>i.cartItem,h=>{s.value=new j.OrderItemBase(h)},{deep:!0}),(h,p)=>{const m=F.NButton;return t.openBlock(),t.createElementBlock("div",Lb,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=g=>r("click:view-switch"))},{default:t.withCtx(()=>[...p[4]||(p[4]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(Ou,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":p[1]||(p[1]=g=>s.value=g),validation:a.value,settings:n.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":p[2]||(p[2]=g=>t.unref(u)(g)),onSubmit:p[3]||(p[3]=g=>f())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),Wb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function jb(n,e){return t.openBlock(),t.createElementBlock("svg",Wb,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 112v288m144-144H112"},null,-1)])])}const Du=t.markRaw({name:"ion-add",render:jb}),qb={key:0,class:"-mt-1 text-sm text-gray-500"},Xb={class:"font-bold"},Yb={class:"flex flex-col gap-3"},Ub={key:0,class:"mt-4 flex flex-col gap-1.5"},Kb={class:"flex flex-col gap-1 text-sm text-gray-700"},Gb={key:0},Zb={key:1},Qb={"form-array-name":"items",class:"flex flex-col gap-3"},Jb={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},e_={key:0,class:"flex flex-wrap items-end gap-2"},t_={class:"whitespace-nowrap text-xl font-bold"},n_={key:0,class:"whitespace-nowrap text-lg text-gray-500"},i_={class:"font-bold"},r_={class:"font-bold"},o_={class:"flex gap-3"},s_={},Lu=t.defineComponent({...s_,__name:"sandwich-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","add-item","remove-item"],setup(n,{expose:e,emit:i}){var D;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(M.cloneDeep(r.value)),l=t.ref({...r.validation}),c=L=>{var z;delete l.value[L],(z=s.value)==null||z.restoreValidation()};t.watch(()=>r.validation,L=>{l.value={...L},Object.values(L).some(P=>P==null?void 0:P.feedback)&&t.nextTick(()=>{var P;return(P=s.value)==null?void 0:P.validate(M.noop).catch(M.noop)})},{deep:!0});const d=t.computed(()=>r.value.category),u=t.ref(null),f=t.ref(null),h=t.computed(()=>d.value.products??[]),p=t.computed(()=>h.value.map(L=>({label:L.name,value:L.id}))),m=(L,z,P)=>{const q=L!=null&&L>0,K=z!=null&&z>0;return!q&&!K?null:q&&K?`от ${L} ${P} до ${z} ${P}`:q?`от ${L} ${P}`:`до ${z} ${P}`},g=t.computed(()=>{var L,z;return m(r.settings.minWidth,(z=(L=u.value)==null?void 0:L.properties)==null?void 0:z.width,"мм")}),b=t.computed(()=>{var L,z;return m(r.settings.minLength,(z=(L=u.value)==null?void 0:L.properties)==null?void 0:z.length,"мм")}),y=t.ref(null),_=t.ref(!1),k=t.computed(()=>{var z;const L={marker:[He.serverValidation((z=l.value.marker)==null?void 0:z.feedback)]};return a.value.configuratorParams.items.forEach((P,q)=>{var K,J,Y,V,A,ie,ce;L[`configuratorParams.items.${q}.width`]=[le.required,le.min(r.settings.minWidth),...(J=(K=u.value)==null?void 0:K.properties)!=null&&J.width?[le.max(u.value.properties.width)]:[],le.step(1),He.serverValidation((Y=l.value[`items.${q}.width`])==null?void 0:Y.feedback)],L[`configuratorParams.items.${q}.length`]=[le.required,le.min(r.settings.minLength),...(A=(V=u.value)==null?void 0:V.properties)!=null&&A.length?[le.max(u.value.properties.length)]:[],le.step(1),He.serverValidation((ie=l.value[`items.${q}.length`])==null?void 0:ie.feedback)],L[`configuratorParams.items.${q}.count`]=[le.required,le.min(1),le.step(1),He.serverValidation((ce=l.value[`items.${q}.count`])==null?void 0:ce.feedback)]}),L}),x=t.ref(r.settings.canSetDopProdaga??!1),v=t.computed(()=>a.value.configuratorParams.items.some(L=>{var z,P;return!u.value||!L.width||L.width<r.settings.minWidth||L.width>(((z=u.value.properties)==null?void 0:z.width)??0)||L.length===0||L.length<r.settings.minLength||L.length>(((P=u.value.properties)==null?void 0:P.length)??0)||!L.count||L.count<1})),B=t.computed(()=>!u.value||v.value||a.value.configuratorParams.items.length===0),w=t.ref(null),T=L=>{if(!L){u.value=null,f.value=null,a.value.product=new j.ClientProduct,y.value=null;return}const z=h.value.find(P=>P.id===L);z&&(u.value=z,f.value=L,a.value.product=z,G("product",a.value.product),a.value.configuratorParams.items.forEach(P=>{var q,K;(q=z.properties)!=null&&q.width&&P.width>z.properties.width&&(P.width=z.properties.width),(K=z.properties)!=null&&K.length&&P.length>z.properties.length&&(P.length=z.properties.length)}),$())};let C=!1;const $=()=>{C=!0,y.value=null,w.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},E=async()=>{var L;if(!u.value||a.value.configuratorParams.items.length===0||v.value){$();return}(L=s.value)==null||L.validate(z=>{if(z){$();return}if(_.value=!0,!u.value||!d.value){$(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:P=>{P?(y.value=P,a.value.configuratorParams.calculationId=P.id,a.value.quantity=P.quantity,t.nextTick(()=>{G("quantity",P.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,$()),G("configuratorParams",a.value.configuratorParams),I(),_.value=!1}})}).catch(()=>{$(),_.value=!1})},I=()=>{var z;if(!((z=u.value)!=null&&z.costRub)||!y.value){w.value=null;return}const L=y.value.quantity*u.value.costRub;w.value=Math.round(L*100)/100},R=L=>{var P,q;const z=a.value.configuratorParams.items[L];u.value&&((P=u.value.properties)!=null&&P.width&&z.width>u.value.properties.width&&(z.width=u.value.properties.width),(q=u.value.properties)!=null&&q.length&&z.length>u.value.properties.length&&(z.length=u.value.properties.length)),G("configuratorParams",a.value.configuratorParams),$()},O=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),G("configuratorParams",a.value.configuratorParams),$(),o("add-item",a.value.configuratorParams.items.length)},U=L=>{a.value.configuratorParams.items.splice(L,1),G("configuratorParams",a.value.configuratorParams),$(),o("remove-item",L)},Q=()=>{if(!(B.value||_.value||r.isSubmitProcessing)){if(!y.value){E();return}o("submit",a.value)}},G=(L,z)=>{const P=new j.OrderItemBase(r.value);P[L]=z,o("update:value",P)};t.watch(()=>r.value,L=>{const z=M.cloneDeep(t.toRaw(L));(!z.configuratorParams.items||z.configuratorParams.items.length===0)&&(z.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=z,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),r.value.product.isNewRec()&&(u.value=null,f.value=null),C?C=!1:W()},{deep:!0});const W=()=>{const{calculationId:L}=a.value.configuratorParams,z=a.value.quantity??0;L&&z>0&&a.value.product&&!a.value.product.isNewRec()&&(y.value={id:L,quantity:z,sheets:[]},I())};return t.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),W()}),e({validate:(D=s.value)==null?void 0:D.validate,formReference:s}),(L,z)=>{const P=fo,q=Du;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:a.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var K;return[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:f.value,"onUpdate:value":[z[0]||(z[0]=J=>f.value=J),T],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((K=u.value)==null?void 0:K.costRub)!=null?(t.openBlock(),t.createElementBlock("div",qb,[t.createElementVNode("span",Xb,t.toDisplayString(u.value.code),1),t.createTextVNode(" — "+t.toDisplayString(u.value.costRub.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol)+"/шт. ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Yb,[u.value?(t.openBlock(),t.createElementBlock("div",Ub,[z[7]||(z[7]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",Kb,[g.value?(t.openBlock(),t.createElementBlock("div",Gb,"Ширина "+t.toDisplayString(g.value)+".",1)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock("div",Zb,"Длина "+t.toDisplayString(b.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",Qb,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value.configuratorParams.items,(J,Y)=>(t.openBlock(),t.createElementBlock("div",{key:Y,class:"flex grow gap-2"},[t.createElementVNode("div",Jb,[t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.width`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].width,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].width=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:z[1]||(z[1]=V=>t.unref(lt)(V)),onInput:V=>c(`items.${Y}.width`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.length`,label:"Длина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].length,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].length=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:z[2]||(z[2]=V=>t.unref(lt)(V)),onInput:V=>c(`items.${Y}.length`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.count`,label:"Количество, шт"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].count,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].count=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:z[3]||(z[3]=V=>t.unref(lt)(V,!1)),onInput:V=>c(`items.${Y}.count`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(F.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:V=>U(Y)},{default:t.withCtx(()=>[t.createVNode(P)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:1,disabled:v.value,type:"default",class:"self-center",onClick:O},{default:t.withCtx(()=>[t.createVNode(q),z[8]||(z[8]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка распила"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:z[4]||(z[4]=J=>c("marker")),"onUpdate:value":z[5]||(z[5]=J=>G("marker",J??null)),onFocus:t.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),x.value?(t.openBlock(),t.createBlock(t.unref(F.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":z[6]||(z[6]=J=>{a.value.isAdditionalSale=J??!1,G("isAdditionalSale",J??!1)})},{default:t.withCtx(()=>[...z[9]||(z[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(t.unref(F.NSpin),{show:_.value,size:"small",class:"grow"},{default:t.withCtx(()=>{var J;return[y.value&&u.value&&w.value?(t.openBlock(),t.createElementBlock("div",e_,[t.createElementVNode("div",null,[z[10]||(z[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",t_,t.toDisplayString(w.value.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol),1)]),y.value.quantity&&u.value?(t.openBlock(),t.createElementBlock("div",n_,[t.createElementVNode("span",i_,"("+t.toDisplayString(y.value.quantity)+" шт.",1),z[11]||(z[11]=t.createTextVNode(" x ",-1)),t.createElementVNode("span",r_,t.toDisplayString((J=u.value.costRub)==null?void 0:J.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]}),_:1},8,["show"]),t.createElementVNode("div",o_,[y.value&&!_.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,loading:n.isSubmitProcessing,disabled:B.value||_.value,type:"primary",class:"self-start",onClick:Q},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:1,loading:_.value,disabled:B.value||_.value,type:"info",class:"self-start",onClick:E},{default:t.withCtx(()=>[...z[12]||(z[12]=[t.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[t.unref(oi),Q]])}}}),a_={class:"flex flex-col gap-2"},l_={class:"w-104 flex grow flex-col px-5"},c_={},Hu=t.defineComponent({...c_,__name:"sandwich-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{},product:{}}),l=t.ref(!1),c=async()=>{var f,h;(h=(f=o.value)==null?void 0:f.formReference)==null||h.validate(p=>{if(!p){l.value=!0;const m=M.cloneDeep(s.value);"items"in m.configuratorParams&&delete m.configuratorParams.items,r("submit",m,a.value,()=>{l.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})})}}).catch(M.noop)},d=f=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}},u=f=>{delete a.value[`items.${f}.width`],delete a.value[`items.${f}.length`],delete a.value[`items.${f}.count`]};return t.onMounted(()=>{i.cartItem.configuratorParams.items.forEach((f,h)=>{a.value[`items.${h}.width`]={},a.value[`items.${h}.length`]={},a.value[`items.${h}.count`]={}})}),t.watch(()=>i.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,h)=>{const p=F.NButton;return t.openBlock(),t.createElementBlock("div",a_,[n.settings.allowShowTable&&s.value.isNewRec()?(t.openBlock(),t.createBlock(p,{key:0,type:"tertiary",class:"self-center",onClick:h[0]||(h[0]=m=>r("click:view-switch"))},{default:t.withCtx(()=>[...h[2]||(h[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",l_,[t.createVNode(Lu,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":h[1]||(h[1]=m=>s.value=m),validation:a.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":l.value,onSubmit:c,onAddItem:d,onRemoveItem:u},null,8,["value","validation","settings","event-emitter","is-submit-processing"])])])}}}),d_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function u_(n,e){return t.openBlock(),t.createElementBlock("svg",d_,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1)])])}const f_=t.markRaw({name:"ion-checkmark",render:u_}),h_={key:0,class:"-mt-1 text-sm text-gray-500"},m_={class:"font-bold"},p_={class:"flex flex-col gap-3"},g_={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},y_={class:"flex flex-col gap-1 text-sm text-gray-700"},b_={key:0},__={key:1},w_={"form-array-name":"items",class:"flex flex-col gap-3"},x_={class:"min-w-0 flex-1"},k_={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},C_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},v_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},S_={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},B_={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},N_={key:0,class:"lg:!flex-[2]"},T_={class:"font-bold"},$_={key:1,class:"lg:!flex-[3]"},E_={class:"font-bold"},R_={key:1,class:"min-w-0 flex flex-col items-end gap-1 text-right text-sm text-gray-700 border-t border-gray-200 pt-2"},P_={key:0},F_={class:"font-bold"},V_={key:1},M_={class:"font-bold"},I_={class:"flex flex-wrap items-center gap-3"},A_={},Wu=t.defineComponent({...A_,__name:"sandwich-m2-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},itemStates:{default:()=>[]}},emits:["submit","update:value","add-item","remove-item","item-reset"],setup(n,{expose:e,emit:i}){var J;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("widthInputs"),l=r.value==null?[]:M.cloneDeep(t.toRaw(r.value)),c=t.ref(l.map(Y=>new j.OrderItemBase(Y))),d=t.computed(()=>({items:c.value})),u=t.ref({...r.validation}),f=Y=>{var V;delete u.value[Y],(V=s.value)==null||V.restoreValidation()},h=t.ref(null),p=t.ref(null),m=t.computed(()=>{var Y,V;return((V=(Y=c.value[0])==null?void 0:Y.category)==null?void 0:V.products)??[]}),g=t.computed(()=>m.value.map(Y=>({label:Y.name,value:Y.id}))),b=(Y,V,A)=>{const ie=Y!=null&&Y>0,ce=V!=null&&V>0;return!ie&&!ce?null:ie&&ce?`от ${Y} ${A} до ${V} ${A}`:ie?`от ${Y} ${A}`:`до ${V} ${A}`},y=t.computed(()=>{var Y,V;return b(r.settings.minWidth,(V=(Y=h.value)==null?void 0:Y.properties)==null?void 0:V.width,"мм")}),_=t.computed(()=>{var Y,V;return b(r.settings.minLength,(V=(Y=h.value)==null?void 0:Y.properties)==null?void 0:V.length,"мм")}),k=t.computed(()=>{const Y={};return c.value.forEach((V,A)=>{var ie,ce,pe,at,we,ke,kt,Ne;Y[`items.${A}.configuratorParams.width`]=[le.required,le.min(r.settings.minWidth),...(ce=(ie=h.value)==null?void 0:ie.properties)!=null&&ce.width?[le.max(h.value.properties.width)]:[],le.step(1),He.serverValidation((pe=u.value[`items.${A}.width`])==null?void 0:pe.feedback)],Y[`items.${A}.configuratorParams.length`]=[le.required,le.min(r.settings.minLength),...(we=(at=h.value)==null?void 0:at.properties)!=null&&we.length?[le.max(h.value.properties.length)]:[],le.step(1),He.serverValidation((ke=u.value[`items.${A}.length`])==null?void 0:ke.feedback)],Y[`items.${A}.quantity`]=[le.required,le.min(1),le.step(1),He.serverValidation((kt=u.value[`items.${A}.quantity`])==null?void 0:kt.feedback)],Y[`items.${A}.marker`]=[He.serverValidation((Ne=u.value[`items.${A}.marker`])==null?void 0:Ne.feedback)]}),Y});t.watch(()=>r.validation,Y=>{u.value={...Y},Object.values(Y).some(A=>A==null?void 0:A.feedback)&&t.nextTick(()=>{var A;return(A=s.value)==null?void 0:A.validate(M.noop).catch(M.noop)})},{deep:!0});const x=t.ref(r.settings.canSetDopProdaga??!1),v=t.computed(()=>{const Y=h.value;return Y?c.value.some(V=>{var pe,at;const A=V.configuratorParams,ie=(pe=Y.properties)==null?void 0:pe.width,ce=(at=Y.properties)==null?void 0:at.length;return A.width===0||A.width<r.settings.minWidth||ie!=null&&A.width>ie||A.length===0||A.length<r.settings.minLength||ce!=null&&A.length>ce||V.quantity===0||V.quantity<1}):!0}),B=t.computed(()=>!h.value||v.value||c.value.length===0),w=t.computed(()=>{const Y=c.value[0];return Y!=null&&!Y.isNewRec()}),T=Y=>r.itemStates[Y]??"idle",C=Y=>T(Y)==="success",$=Y=>T(Y)==="loading",E=t.computed(()=>c.value.length===0?!0:c.value.every((Y,V)=>{const A=T(V);return A==="success"||A==="loading"})),I=Y=>Y.width===0||Y.length===0?0:Y.width*Y.length/1e6,R=Y=>I(Y).toLocaleString(void 0,{maximumFractionDigits:4}),O=Y=>{var pe;const V=Y.configuratorParams,A=I(V),ie=((pe=h.value)==null?void 0:pe.costRub)??0,ce=Y.quantity??0;return!A||!ce?0:Math.round(A*ie*ce*100)/100},U=t.computed(()=>M.sum(c.value.map(Y=>{const V=Y.configuratorParams;return!V.width||V.length===0||!Y.quantity?0:V.width*V.length*Y.quantity/1e6}))),Q=t.computed(()=>Math.round(M.sum(c.value.map(Y=>O(Y)))*100)/100),G=()=>{var Y,V,A;return new j.OrderItemBase({category:(Y=c.value[0])==null?void 0:Y.category,configurator:(V=c.value[0])==null?void 0:V.configurator,product:h.value??new j.ClientProduct,quantity:1,isAdditionalSale:(A=c.value[0])==null?void 0:A.isAdditionalSale,configuratorParams:{width:0,length:0}})},W=Y=>{if(!Y){h.value=null,p.value=null,c.value.forEach(A=>{A.product=new j.ClientProduct}),o("update:value",c.value);return}const V=m.value.find(A=>A.id===Y);V&&(h.value=V,p.value=Y,c.value.forEach((A,ie)=>{var ce,pe;A.product=V,(ce=V.properties)!=null&&ce.width&&A.configuratorParams.width>V.properties.width&&(A.configuratorParams.width=V.properties.width),(pe=V.properties)!=null&&pe.length&&A.configuratorParams.length>V.properties.length&&(A.configuratorParams.length=V.properties.length),o("item-reset",ie)}),o("update:value",c.value))},D=Y=>{var ie,ce;const V=c.value[Y],A=h.value;A&&((ie=A.properties)!=null&&ie.width&&V.configuratorParams.width>A.properties.width&&(V.configuratorParams.width=A.properties.width),(ce=A.properties)!=null&&ce.length&&V.configuratorParams.length>A.properties.length&&(V.configuratorParams.length=A.properties.length)),o("item-reset",Y),o("update:value",c.value)},L=(Y,V)=>{c.value[Y].marker=V===null||V===""?void 0:V,o("item-reset",Y),o("update:value",c.value)},z=Y=>{c.value.forEach(V=>{V.isAdditionalSale=Y}),o("update:value",c.value)},P=()=>{c.value.push(G()),o("update:value",c.value),o("add-item",c.value.length),t.nextTick(()=>{var V,A,ie,ce;const Y=c.value.length-1;(A=(V=a.value)==null?void 0:V[Y])==null||A.focus(),(ce=(ie=a.value)==null?void 0:ie[Y])==null||ce.select()})},q=Y=>{c.value.splice(Y,1),o("update:value",c.value),o("remove-item",Y)};t.watch(()=>r.value,Y=>{var ce;const A=(Y==null?[]:M.cloneDeep(t.toRaw(Y))).map(pe=>new j.OrderItemBase(pe));c.value=A.length>0?A:[G()];const ie=(ce=c.value[0])==null?void 0:ce.product;ie&&!ie.isNewRec()?(h.value=ie,p.value=ie.id):(h.value=null,p.value=null)},{deep:!0});const K=()=>{var V;if(h.value!==null)return;const Y=(V=m.value[0])==null?void 0:V.id;Y!=null&&W(Y)};return t.watch(m,()=>{K()}),t.onMounted(()=>{var V;c.value.length===0&&(c.value=[G()]);const Y=(V=c.value[0])==null?void 0:V.product;Y&&!Y.isNewRec()&&(h.value=Y,p.value=Y.id),K()}),e({validate:(J=s.value)==null?void 0:J.validate,formReference:s}),(Y,V)=>{const A=f_,ie=fo,ce=Du;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:d.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var pe,at;return[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:p.value,"onUpdate:value":[V[0]||(V[0]=we=>p.value=we),W],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((pe=h.value)==null?void 0:pe.costRub)!=null?(t.openBlock(),t.createElementBlock("div",h_,[t.createElementVNode("span",m_,t.toDisplayString(h.value.code),1),t.createTextVNode(" — "+t.toDisplayString(h.value.costRub.toLocaleString())+" "+t.toDisplayString(h.value.currency.symbol)+"/м² ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",p_,[h.value?(t.openBlock(),t.createElementBlock("div",g_,[V[6]||(V[6]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",y_,[y.value?(t.openBlock(),t.createElementBlock("div",b_,"Ширина "+t.toDisplayString(y.value)+".",1)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock("div",__,"Длина "+t.toDisplayString(_.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",w_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value.items,(we,ke)=>{var kt;return t.openBlock(),t.createElementBlock("div",{key:ke,class:t.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",C(ke)?"opacity-70":""])},[t.createElementVNode("div",x_,[t.createElementVNode("div",k_,[t.createElementVNode("div",C_,[t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[ke].configuratorParams.width,"onUpdate:value":[Ne=>d.value.items[ke].configuratorParams.width=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Ширина",class:"w-full",onKeydown:V[1]||(V[1]=Ne=>t.unref(lt)(Ne)),onInput:Ne=>f(`items.${ke}.width`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:d.value.items[ke].configuratorParams.length,"onUpdate:value":[Ne=>d.value.items[ke].configuratorParams.length=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Длина",class:"w-full",onKeydown:V[2]||(V[2]=Ne=>t.unref(lt)(Ne)),onInput:Ne=>f(`items.${ke}.length`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createElementVNode("div",v_,[t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:d.value.items[ke].quantity,"onUpdate:value":[Ne=>d.value.items[ke].quantity=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Кол-во",class:"w-full",onKeydown:V[3]||(V[3]=Ne=>t.unref(lt)(Ne,!1)),onInput:Ne=>f(`items.${ke}.quantity`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.marker`,label:"Маркировка",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:d.value.items[ke].marker??null,disabled:!h.value||C(ke)||$(ke),placeholder:"Маркировка",class:"w-full",onInput:Ne=>f(`items.${ke}.marker`),"onUpdate:value":Ne=>L(ke,Ne??null),onFocus:t.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),$(ke)||C(ke)?(t.openBlock(),t.createElementBlock("div",S_,[$(ke)?(t.openBlock(),t.createBlock(t.unref(F.NSpin),{key:0,size:14})):C(ke)?(t.openBlock(),t.createBlock(A,{key:1,class:"text-green-600 text-xl"})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",B_,[we.configuratorParams.width>0&&we.configuratorParams.length>0?(t.openBlock(),t.createElementBlock("div",N_,[V[7]||(V[7]=t.createTextVNode(" Площадь (S) = ",-1)),t.createElementVNode("span",T_,t.toDisplayString(R(we.configuratorParams))+" м²",1)])):t.createCommentVNode("",!0),O(we)>0?(t.openBlock(),t.createElementBlock("div",$_,[V[8]||(V[8]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",E_,t.toDisplayString(O(we).toLocaleString())+" "+t.toDisplayString((kt=h.value)==null?void 0:kt.currency.symbol),1)])):t.createCommentVNode("",!0)])]),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,disabled:$(ke)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Ne=>q(ke)},{default:t.withCtx(()=>[t.createVNode(ie)]),_:1},8,["disabled","onClick"]))],2)}),128))]),h.value?(t.openBlock(),t.createElementBlock("div",R_,[U.value>0?(t.openBlock(),t.createElementBlock("div",P_,[V[9]||(V[9]=t.createTextVNode(" Общая площадь: ",-1)),t.createElementVNode("span",F_,t.toDisplayString(U.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):t.createCommentVNode("",!0),Q.value>0?(t.openBlock(),t.createElementBlock("div",V_,[V[10]||(V[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",M_,t.toDisplayString(Q.value.toLocaleString())+" "+t.toDisplayString(h.value.currency.symbol),1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),x.value?(t.openBlock(),t.createBlock(t.unref(F.NCheckbox),{key:1,checked:((at=c.value[0])==null?void 0:at.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":V[4]||(V[4]=we=>z(we??!1))},{default:t.withCtx(()=>[...V[11]||(V[11]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createElementVNode("div",I_,[h.value&&!w.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,disabled:v.value,type:"default",onClick:P},{default:t.withCtx(()=>[t.createVNode(ce),V[12]||(V[12]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:B.value||E.value,type:"primary",class:"ml-auto",onClick:V[5]||(V[5]=we=>o("submit",c.value))},{default:t.withCtx(()=>{var we;return[t.createTextVNode(t.toDisplayString((we=c.value[0])!=null&&we.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",c.value)]])}}}),O_={class:"flex flex-col gap-2"},z_={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},D_={},ju=t.defineComponent({...D_,__name:"sandwich-m2-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["click:view-switch","submit"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-m2-configurator-form"),s=t.ref((i.cartItems??[]).map(k=>new j.OrderItemBase(k))),a=t.ref([]),l=t.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=k=>{c.forEach(x=>{l.value[`items.${k}.${x}`]={}})},u=k=>{c.forEach(x=>{delete l.value[`items.${k}.${x}`]})},f=t.computed(()=>a.value.includes("loading")),h=()=>({width:{},length:{},quantity:{},marker:{}}),p=(k,x)=>{let v=!1;return c.forEach(B=>{var I,R;const w=`items.0.${B}`,T=(I=k[B])==null?void 0:I.feedback,$=((R=k[w])==null?void 0:R.feedback)??T,E=`items.${x}.${B}`;$?(l.value[E]=k[w]??k[B],v=!0):l.value[E]={}}),v},m=(k,x,v)=>new Promise(B=>{const w=h();let T=!1;const C=$=>{if(T)return;T=!0;const E=p(w,x),I=($===void 0?!E:$)&&!E;a.value[x]=I?"success":"error",t.nextTick(()=>{var R,O;(O=(R=o.value)==null?void 0:R.formReference)==null||O.restoreValidation()}),B(I)};a.value[x]="loading",r("submit",[M.cloneDeep(k)],w,C,{isFinalSuccessfulCompletion:v})}),g=async()=>{var v,B;try{await((B=(v=o.value)==null?void 0:v.formReference)==null?void 0:B.validate())}catch{return}const k=s.value.map((w,T)=>T).filter(w=>{const T=a.value[w]??"idle";return T!=="success"&&T!=="loading"});let x=!0;for(let w=0;w<k.length;w+=1){const T=k[w],C=s.value[T];if(!C)break;const E=w===k.length-1&&x;await m(C,T,E)||(x=!1)}},b=k=>{const x=k-1;a.value[x]="idle",d(x)},y=k=>{a.value.splice(k,1),u(k);for(let x=k;x<s.value.length;x+=1)d(x)},_=k=>{const x=a.value[k];(x==="success"||x==="error")&&(a.value[k]="idle")};return t.onMounted(()=>{(i.cartItems??[]).forEach((k,x)=>{a.value[x]="idle",d(x)})}),t.watch(()=>i.cartItems,k=>{const x=(k??[]).map(v=>new j.OrderItemBase(v));s.value=x,a.value=x.map(()=>"idle"),x.forEach((v,B)=>{d(B)})},{deep:!0}),(k,x)=>{var B;const v=F.NButton;return t.openBlock(),t.createElementBlock("div",O_,[n.settings.allowShowTable&&((B=s.value[0])!=null&&B.isNewRec())?(t.openBlock(),t.createBlock(v,{key:0,type:"tertiary",class:"self-center",onClick:x[0]||(x[0]=w=>r("click:view-switch"))},{default:t.withCtx(()=>[...x[2]||(x[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",z_,[t.createVNode(Wu,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":x[1]||(x[1]=w=>s.value=w),validation:l.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":f.value,"item-states":a.value,onSubmit:g,onAddItem:b,onRemoveItem:y,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),L_={key:0,class:"flex justify-center p-4"},H_={key:1,class:"p-4 text-center text-red-500"},W_={key:2,class:"flex justify-center"},j_={class:"!bg-white p-4 m-2 rounded-md w-max"},q_={key:3,class:"p-4 text-center text-gray-500"},X_={},qu=t.defineComponent({...X_,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},cartItems:{},category:{}},setup(n){const e=n,i=t.ref(!1),r=t.ref(null),o=t.ref(e.cartItem??null),s=t.ref(e.cartItems??null),a=h=>{const p=h.configuratorParams;return[new j.OrderItemBase({...h,quantity:h.quantity??1,marker:h.marker,configuratorParams:{width:(p==null?void 0:p.width)??h.width??0,length:(p==null?void 0:p.length)??h.length??0}})]},l=t.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var p,m,g;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const h={category:((p=e.cartItem)==null?void 0:p.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:M.some(b.startTailConfigs,y=>y.isDefault)?(m=b.startTailConfigs)==null?void 0:m.findIndex(y=>y.isDefault):void 0,endTailType:M.some(b.endTailConfigs,y=>y.isDefault)?(g=b.endTailConfigs)==null?void 0:g.findIndex(y=>y.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{width:0,height:0,netType:b.netType[0]||"",color:b.color[0]||"",mountType:b.mountType[0]||""}});break}case"strip":{const b=e.settings;s.value=[new j.OrderItemBase({...h,length:b.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{width:b.minWidth,length:b.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...h,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...h,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(h,p,m)=>{const g=b=>{m==null||m(),b&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:h,callback:g,validation:p})},u=(h,p,m,g)=>{const b=h[0];if(!b){m==null||m();return}const y=(g==null?void 0:g.isFinalSuccessfulCompletion)===!0,_=k=>{m==null||m(k),y&&k&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:b,callback:_,validation:p,additionalParams:g})},f=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return t.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(h,p)=>{const m=F.NSpin;return t.openBlock(),t.createElementBlock(t.Fragment,null,[i.value?(t.openBlock(),t.createElementBlock("div",L_,[t.createVNode(m,{size:"large"})])):r.value?(t.openBlock(),t.createElementBlock("div",H_,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0),n.settings!==null&&(o.value!==null||s.value!==null||l.value!==null)?(t.openBlock(),t.createElementBlock("div",W_,[t.createElementVNode("div",j_,[n.editor==="kozyrek"?(t.openBlock(),t.createBlock(Eu,{key:0,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="mosquitto"?(t.openBlock(),t.createBlock(Fu,{key:1,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="strip"?(t.openBlock(),t.createBlock(Au,{key:2,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":s.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):n.editor==="metal_for_doors"?(t.openBlock(),t.createBlock(zu,{key:3,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich"?(t.openBlock(),t.createBlock(Hu,{key:4,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich_m2"?(t.openBlock(),t.createBlock(ju,{key:5,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":l.value,"onClick:viewSwitch":f,onSubmit:u},null,8,["event-emitter","settings","cart-items"])):t.createCommentVNode("",!0)])])):(t.openBlock(),t.createElementBlock("div",q_,' Конфигуратор "'+t.toDisplayString(n.editor)+'" не поддерживается. ',1))],64)}}});function Xu(n){return Object.values(j.ConfiguratorsEnum).includes(n)}function Yu(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:n.properties.configuratorSettings!==void 0&&M.isArray(n.products)&&n.products.length>0}const Y_={key:0,class:"pt-0.5"},U_={key:0},K_={class:"line-through"},G_={key:0},Z_={key:1},Q_={class:"flex flex-row gap-1"},J_={key:0},ew={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},tw={class:"flex flex-col gap-2.5 sm:flex-row"},nw={key:0,class:"header-extra"},iw={class:"inline-flex"},rw={class:"inline-flex"},ow={class:"inline-flex"},sw={class:"mt-2"},aw={key:1,class:"flex flex-col"},lw={},cw=t.defineComponent({...lw,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},isCategoryItemSelected:{type:[Boolean,String,Function],default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function],default:!1},showCategoryRequiredButton:{type:[Boolean,String,Function],default:!1},showCategoryPinButton:{type:[Boolean,String,Function],default:!1},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function],default:!1},canShowConfigurator:{type:[Boolean,Function],default:!1},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(n){const e=n,i=t.inject(Br,"medium"),r=t.computed(()=>{var V;return(V=e==null?void 0:e.filteredItems)==null?void 0:V[e.categoryItem.id]}),o=t.computed(()=>{var V,A;return M.isArray((V=e.categoryItem)==null?void 0:V.categories)&&((A=e.categoryItem.categories)==null?void 0:A.length)>0}),s=t.computed(()=>{var V;return M.isArray((V=e.categoryItem)==null?void 0:V.products)?e.categoryItem.products:[]}),a=t.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([V,A])=>`${A} руб./${O(V)}`).join(", ")),l=t.computed(()=>M.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(V=>{var ie;const A=(ie=r.value)==null?void 0:ie.products;return M.isArray(A)&&A.includes(V.id)})),c=t.computed(()=>l.value.length>0),d=t.computed(()=>M.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=t.computed(()=>M.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),f=t.computed(()=>M.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),h=t.computed(()=>{var ie,ce;const V=(ie=k.value)==null?void 0:ie.hidingComment,A=(ce=k.value)!=null&&ce.isDisabled?`Скрыто для клиента${V?`. Причина: '${V}'`:""}`:"Видимо клиенту";return d.value==="disabled"?`${A}. ${kr}`:A}),p=t.computed(()=>{var ie;const V=(ie=k.value)==null?void 0:ie.manager,A=V?`Категория закреплена за "${V.name??"-"}"`:"Закрепить";return u.value==="disabled"?`${A}. ${kr}`:A}),m=t.computed(()=>f.value==="disabled"?`${Cs}. ${kr}`:Cs),g=t.computed(()=>M.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),b=t.computed(()=>{var V,A,ie;return((V=e.categoryItem.properties)==null?void 0:V.configurator)!==void 0&&Xu((A=e.categoryItem.properties)==null?void 0:A.configurator)&&Yu(e.categoryItem)&&((ie=e.categoryItem.properties)==null?void 0:ie.configuratorSettings)!==void 0&&(M.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),y=t.computed(()=>b.value&&(M.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),_=t.computed(()=>M.isNil(e.categoryContextButtonsConfig)?[]:M.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),k=t.computed(()=>new j.ClientCategory(e.categoryItem)),x=t.ref(!1),v=t.ref(!1),B=t.computed(()=>!M.isUndefined(e.isCategoryItemSelected)),w=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),T=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),C=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),$=t.computed(()=>K.value&&Xe.getDeviceTypeByResolution()===je.laptop?"auto":"fixed"),E=t.useTemplateRef("collapse-item-reference"),I=t.computed(()=>{var V,A;return(A=(V=e.categoryItem.properties)==null?void 0:V.templateCost)==null?void 0:A.priceCoefficient}),R=t.computed(()=>{var V,A;return(A=(V=e.categoryItem.properties)==null?void 0:V.templateCost)==null?void 0:A.increasePercent}),O=(V,A="ru-RU")=>0 .toLocaleString(A,{style:"currency",currency:V,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),U=V=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:V,target:E.value})},Q=(V,A)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:A,isLoadingState:x,target:E.value})},G=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:E.value})},W=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:E.value})},D=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:E.value})},L=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:E.value})},z=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:E.value})},P=V=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:V,target:E.value})},q=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},K=t.ref(0),J=t.computed(()=>K.value&&s.value.length>0?Qg(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),Y=M.debounce(()=>{K.value=window.innerWidth},20);return t.onUnmounted(()=>{window.removeEventListener("resize",Y),Y.cancel()}),window.addEventListener("resize",Y),Y(),(V,A)=>{const ie=F.NCheckbox,ce=up,pe=F.NTooltip,at=lp,we=F.NTag,ke=op,kt=np,Ne=F.NButton,Jt=Jm,wn=Ql,Pt=Zl,ni=Gl,On=$s,cn=F.NDropdown,pt=F.NDataTable,se=F.NAlert,de=F.NSpin;return t.openBlock(),t.createBlock(Jl,{ref:"collapse-item-reference",name:n.categoryItem.id,"data-id":n.categoryItem.id,"onHeader:click":Q},{"pre-arrow":t.withCtx(()=>{var Re,qe;return[B.value?(t.openBlock(),t.createElementBlock("div",Y_,[t.createVNode(ie,{checked:w.value,indeterminate:C.value,disabled:T.value,"onUpdate:checked":U},null,8,["checked","indeterminate","disabled"])])):t.createCommentVNode("",!0),!d.value&&((Re=k.value)!=null&&Re.isDisabled)?(t.openBlock(),t.createBlock(pe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(ce,{class:"pt-1.5"})]),default:t.withCtx(()=>[A[1]||(A[1]=t.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):t.createCommentVNode("",!0),((qe=k.value)==null?void 0:qe.isFavorite)??!1?(t.openBlock(),t.createBlock(pe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(at,{class:"pt-1.5"})]),default:t.withCtx(()=>[A[2]||(A[2]=t.createTextVNode(" Избранная категория ",-1))]),_:1})):t.createCommentVNode("",!0)]}),header:t.withCtx(()=>{var Re,qe,dn,Kt,ii;return[t.createElementVNode("div",{class:t.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":n.categoryItem.isHidden,"text-gray-400":(Re=k.value)==null?void 0:Re.isDisabled})},[t.createVNode(pe,{disabled:!n.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(n.categoryItem.name),1)]),default:t.withCtx(()=>[A[3]||(A[3]=t.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),t.createElementVNode("div",{class:"w-fit",onClick:A[0]||(A[0]=t.withModifiers((...it)=>t.unref(M.noop)&&t.unref(M.noop)(...it),["prevent","stop"]))},[(qe=n.categoryItem.properties)!=null&&qe.m2Price?(t.openBlock(),t.createBlock(we,{key:0,size:t.unref(i),class:t.normalizeClass({"!pr-0":((dn=n.categoryItem.properties)==null?void 0:dn.templateCost)&&n.categoryItem.properties.m2PriceRetail&&R.value}),round:""},{default:t.withCtx(()=>{var it;return[t.createTextVNode(" Установленная стоимость: "+t.toDisplayString(n.categoryItem.properties.m2Price)+" руб./м2 ",1),(it=n.categoryItem.properties)!=null&&it.templateCost&&n.categoryItem.properties.m2PriceRetail&&R.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[R.value?(t.openBlock(),t.createBlock(we,{key:0,type:"success",bordered:!1,size:t.unref(i),class:"ml-2 !pr-0",round:""},{default:t.withCtx(()=>[R.value?(t.openBlock(),t.createElementBlock("span",U_,t.toDisplayString(R.value.toFixed(2))+"%",1)):t.createCommentVNode("",!0),t.createVNode(we,{size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createElementVNode("span",K_,t.toDisplayString(n.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(Kt=n.categoryItem.properties)!=null&&Kt.templateCost?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[I.value||R.value?(t.openBlock(),t.createBlock(we,{key:0,size:t.unref(i),round:""},{default:t.withCtx(()=>{var it;return[I.value?(t.openBlock(),t.createElementBlock("span",G_,t.toDisplayString((it=I.value)==null?void 0:it.name),1)):t.createCommentVNode("",!0),R.value?(t.openBlock(),t.createElementBlock("span",Z_,t.toDisplayString(R.value>0?"+":"")+t.toDisplayString(R.value.toFixed(2))+"%",1)):t.createCommentVNode("",!0)]}),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),a.value?(t.openBlock(),t.createBlock(we,{key:2,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Фиксированный курс: "+t.toDisplayString(a.value),1)]),_:1},8,["size"])):t.createCommentVNode("",!0),u.value&&((ii=k.value)!=null&&ii.manager)?(t.openBlock(),t.createBlock(we,{key:3,size:t.unref(i),closable:u.value!=="disabled",round:"",class:"align-bottom",onClose:L},{default:t.withCtx(()=>[t.createVNode(pe,{placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>{var it,en;return[t.createElementVNode("span",Q_,[t.createVNode(ke),t.createTextVNode(" "+t.toDisplayString((en=(it=k.value)==null?void 0:it.manager)==null?void 0:en.name),1)])]}),default:t.withCtx(()=>{var it,en;return[t.createTextVNode(' Категория закреплена за "'+t.toDisplayString((en=(it=k.value)==null?void 0:it.manager)==null?void 0:en.name)+'" ',1)]}),_:1})]),_:1},8,["size","closable"])):t.createCommentVNode("",!0)])]}),"sub-header":t.withCtx(()=>[n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",J_,[t.createElementVNode("ul",ew,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.categoryItem.id,slug:n.categoryItem.slug},(Re,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(Re),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.categoryItem.properties,(Re,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(Re),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)]),"header-extra":t.withCtx(()=>{var Re;return[t.createElementVNode("div",tw,[V.$slots["header-extra"]?(t.openBlock(),t.createElementBlock("div",nw,[t.renderSlot(V.$slots,"header-extra",{categoryItem:n.categoryItem},void 0,!0)])):t.createCommentVNode("",!0),d.value?(t.openBlock(),t.createBlock(pe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",iw,[t.createVNode(Ne,{ghost:!0,disabled:d.value==="disabled",size:t.unref(i),onClick:G},{default:t.withCtx(()=>{var qe;return[(qe=k.value)!=null&&qe.isDisabled?(t.openBlock(),t.createBlock(ce,{key:1})):(t.openBlock(),t.createBlock(kt,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(h.value),1)]),_:1})):t.createCommentVNode("",!0),u.value&&!((Re=k.value)!=null&&Re.manager)?(t.openBlock(),t.createBlock(pe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",rw,[t.createVNode(Ne,{ghost:!0,disabled:u.value==="disabled",size:t.unref(i),onClick:D},{default:t.withCtx(()=>[t.createVNode(Jt)]),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(p.value),1)]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(pe,{key:3,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",ow,[t.createVNode(Ne,{ghost:!0,disabled:f.value==="disabled",size:t.unref(i),onClick:W},{default:t.withCtx(()=>{var qe;return[(qe=k.value)!=null&&qe.isRequired?(t.openBlock(),t.createBlock(Pt,{key:1})):(t.openBlock(),t.createBlock(wn,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(m.value),1)]),_:1})):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createBlock(pe,{key:4,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(Ne,{ghost:!0,size:t.unref(i),type:"primary",onClick:z},{default:t.withCtx(()=>[t.createVNode(ni)]),_:1},8,["size"])]),default:t.withCtx(()=>[A[4]||(A[4]=t.createTextVNode(" Редактировать ",-1))]),_:1})):t.createCommentVNode("",!0),_.value.length>0?(t.openBlock(),t.createBlock(cn,{key:5,options:_.value,size:t.unref(i),trigger:"click",onSelect:P},{default:t.withCtx(()=>[t.createVNode(Ne,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(On)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])]}),default:t.withCtx(()=>[t.renderSlot(V.$slots,"default",{},()=>{var Re,qe,dn;return[t.createElementVNode("div",sw,[o.value?(t.openBlock(),t.createBlock(Ku,{key:0,"categories-items":n.categoryItem.categories??[],"has-products":c.value||x.value,"event-emitter":n.eventEmitter,"filtered-items":r.value?((Re=r.value)==null?void 0:Re.categories)??{}:void 0,"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[V.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:Kt})=>[t.renderSlot(V.$slots,"header-extra",{categoryItem:Kt},void 0,!0)]),key:"0"}:void 0]),1032,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-product-info-button","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):t.createCommentVNode("",!0)]),b.value&&y.value?(t.openBlock(),t.createBlock(qu,{key:0,"event-emitter":n.eventEmitter,settings:(qe=n.categoryItem.properties)==null?void 0:qe.configuratorSettings,editor:(dn=n.categoryItem.properties)==null?void 0:dn.configurator,category:n.categoryItem},null,8,["event-emitter","settings","editor","category"])):c.value?(t.openBlock(),t.createElementBlock("div",aw,[b.value?(t.openBlock(),t.createBlock(Ne,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:q},{default:t.withCtx(()=>[...A[5]||(A[5]=[t.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(pt,{columns:J.value,data:l.value,bordered:!0,loading:x.value,remote:!0,"row-key":Kt=>Kt.id,"table-layout":$.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):t.createCommentVNode("",!0),!x.value&&!v.value&&!o.value&&!c.value?(t.openBlock(),t.createBlock(se,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createBlock(se,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):t.createCommentVNode("",!0),x.value?(t.openBlock(),t.createBlock(de,{key:4,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...A[6]||(A[6]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),dw=fn(cw,[["__scopeId","data-v-a02c9f27"]]),uw={class:"sc-collapse flex w-full flex-col"},fw={},Uu=t.defineComponent({...fw,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(n,{emit:e}){const i=n,r=e,o=(s,a)=>{r("on-item-header-click",s,a)};return t.provide("itemHeaderClickHandler",o),t.provide("defaultExpandedNames",i.defaultExpandedNames),t.provide("expandedNames",i.expandedNames),(s,a)=>(t.openBlock(),t.createElementBlock("div",uw,[t.renderSlot(s.$slots,"default")]))}}),hw={},Ku=t.defineComponent({...hw,__name:"category-collapse",props:{categoriesItems:{},hasProducts:{type:Boolean},loading:{type:Boolean,default:!1},client:{default:void 0},filteredItems:{default:void 0},isCategoryItemSelected:{type:[Boolean,String,Function],default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function]},showCategoryRequiredButton:{type:[Boolean,String,Function]},showCategoryPinButton:{type:[Boolean,String,Function]},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function]},canShowConfigurator:{type:[Boolean,Function]},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(n){const e=n,i=t.inject(Br,"medium"),r=t.computed(()=>M.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(M.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(t.toRaw(l)),c};return(s,a)=>{const l=F.NSpin,c=F.NAlert;return t.openBlock(),t.createElementBlock(t.Fragment,null,[r.value.length>0?(t.openBlock(),t.createBlock(Uu,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,d=>(t.openBlock(),t.createBlock(dw,{key:d.id,"category-item":d,"event-emitter":n.eventEmitter,"filtered-items":o(d,n.filteredItems),"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[s.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:u})=>[t.renderSlot(s.$slots,"header-extra",{categoryItem:u})]),key:"0"}:void 0]),1032,["category-item","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-product-info-button","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"]))),128))]),_:3})):n.loading?(t.openBlock(),t.createBlock(l,{key:1,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...a[0]||(a[0]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0),!n.hasProducts&&!n.loading&&n.categoriesItems.length>0&&r.value.length===0?(t.openBlock(),t.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):t.createCommentVNode("",!0)],64)}}}),mw={},Gu=t.defineComponent({...mw,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!1},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0},disabledItem:{type:Function,default:void 0}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=new j.Reference,l=t.computed(()=>M.isNil(r.value)?s.value?[]:null:M.isArray(r.value)?r.value.filter(m=>!M.isNil(m)).map(m=>m.id):r.value.id),c=t.computed(()=>gt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=m=>{var g;if(M.isArray(m)){const b=m.length>0?m.map(y=>{var _;return(_=c.value.find(k=>k.value===y))==null?void 0:_.item}).filter(y=>!M.isNil(y)):[];o("update:value",b)}else{const b=m===a.id||M.isNil(m)||(g=c.value.find(y=>y.value===m))==null?void 0:g.item;o("update:value",b)}},f=t.useTemplateRef("select-component");return e({focus:()=>{var m;return(m=f.value)==null?void 0:m.focus()},blur:()=>{var m;return(m=f.value)==null?void 0:m.blur()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(F.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled||c.value.length===0,filterable:n.filterable,"max-tag-count":n.maxTagCount,multiple:s.value,options:d.value,placeholder:"",class:"w-full","onUpdate:value":u},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),pw={},gw=t.defineComponent({...pw,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},disabledCoefficient:{type:Function},visibleCoefficient:{type:Function}},emits:["update:value"],setup(n,{emit:e}){var x,v;const i=n,r=e,o=()=>{const B=j.PriceCoefficient.getRetailPriceCoefficient();return M.unset(B,"isNewRec"),B},s=B=>!B||B.id===o().id,a=t.computed(()=>{var B;return((B=i.catalogItem)==null?void 0:B.type)==="product"}),l=t.computed(()=>a.value?i.catalogItem:void 0),c=B=>{var w,T,C,$;return B.id===o().id?(w=l.value)==null?void 0:w.getRetailCost():($=(C=(T=l.value)==null?void 0:T.priceCoefficients)==null?void 0:C.find(E=>E.coefficient.id===B.id))==null?void 0:$.cost},d=t.computed(()=>{var T;const w=[...((T=j.useReferencesStore().priceCoefficientsReference)==null?void 0:T.map(C=>structuredClone(t.toRaw(C))))??[],o()].filter(C=>{var $;return(($=i.visibleCoefficient)==null?void 0:$.call(i,C))??!0});return a.value&&w.forEach(C=>{var E;const $=c(C);$?C.name+=` (${$} ${(E=l.value)==null?void 0:E.currency.symbol})`:C.name=""}),w.filter(C=>C.name!=="")}),u=t.ref(i.value.coefficient),f=t.ref(((v=(x=i.value)==null?void 0:x.value)==null?void 0:v.toString())??null),h=t.ref(null),p=t.computed(()=>{var B,w;return(w=(B=l.value)==null?void 0:B.priceCoefficients)==null?void 0:w.find(T=>T.coefficient.slug===j.PriceCoefficientEnum.K0)}),m=t.ref(void 0),g=B=>Number.parseFloat((B??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),b=()=>{var w,T;m.value=void 0;let B=g(f.value);if(B=Number.isNaN(B)?void 0:B,a.value)if(u.value||f.value){const C=o(),$=c(u.value??C)??0,E=$+$*((B??0)/100);h.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(E),E>(((w=l.value)==null?void 0:w.getRetailCost())??E)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),p.value&&E<(((T=p.value)==null?void 0:T.cost)??0)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else h.value=null;r("update:value",{value:Number.isNaN(B)?void 0:B,coefficient:s(u.value)?void 0:structuredClone(t.toRaw(u.value))})},y=B=>{M.isArray(B)||M.isNull(B)||(u.value=B,f.value=null,!u.value&&f.value&&(u.value=o()),b())},_=()=>{u.value||(u.value=o()),b()},k=B=>{var T,C,$,E,I;const w=g(B);if(a.value){if(Number.isNaN(w)){u.value=void 0,f.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let R=0;if(w<=0)u.value=void 0,f.value=null;else if(p.value&&w<(((T=p.value)==null?void 0:T.cost)??0))u.value=(C=p.value)==null?void 0:C.coefficient,R=(w-p.value.cost)*100/p.value.cost,m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(w>((($=l.value)==null?void 0:$.getRetailCost())??w)){u.value=o();const O=((E=l.value)==null?void 0:E.getRetailCost())??0;R=(w-O)*100/O,m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const O=((I=l.value)==null?void 0:I.priceCoefficients)??[],U=M.sortBy(O,[W=>W.cost]),G=U.filter(W=>W.cost<=w).at(-1)??U.at(0);G&&(u.value=G.coefficient,R=(w-G.cost)*100/G.cost),m.value={validationStatus:void 0,feedback:void 0}}f.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(R),r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:s(u.value)?void 0:structuredClone(t.toRaw(u.value))})}else r("update:value",{value:Number.isNaN(w)?void 0:w,coefficient:void 0})};return t.onMounted(()=>{var B,w,T,C;i.calculationType===j.CalculationTypeEnum.m2Cost?h.value=((w=(B=i.value)==null?void 0:B.value)==null?void 0:w.toString())??null:!((T=i.value)!=null&&T.coefficient)&&((C=i.value)!=null&&C.value)&&(u.value=o()),b()}),(B,w)=>{var $,E,I;const T=F.NInput,C=F.NInputGroup;return t.openBlock(),t.createBlock(t.unref(F.NFormItem),{"show-label":!t.unref(M.isNil)(n.label),label:n.label,"show-feedback":!t.unref(M.isNil)((($=m.value)==null?void 0:$.feedback)??n.feedback),feedback:((E=m.value)==null?void 0:E.feedback)??n.feedback,"validation-status":((I=m.value)==null?void 0:I.validationStatus)??n.validationStatus},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass([{"sm:grid-cols-3":a.value&&n.calculationType!==t.unref(j.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[n.calculationType!==t.unref(j.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(C,{key:0,class:t.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:t.withCtx(()=>[t.createVNode(Gu,{class:"w-full min-w-0 flex-1",value:u.value,"reference-list":d.value,clearable:n.clearable,disabled:n.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"disabled-item":n.disabledCoefficient,"onUpdate:value":y},null,8,["value","reference-list","clearable","disabled","disabled-item"]),t.createVNode(T,{value:f.value,"onUpdate:value":[w[0]||(w[0]=R=>f.value=R),_],clearable:n.clearable,disabled:n.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},t.createSlots({suffix:t.withCtx(()=>[w[3]||(w[3]=t.createTextVNode("%",-1))]),_:2},[f.value&&!f.value.startsWith("-")?{name:"prefix",fn:t.withCtx(()=>[w[2]||(w[2]=t.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):t.createCommentVNode("",!0),a.value||n.calculationType===t.unref(j.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(T,{key:1,value:h.value,"onUpdate:value":[w[1]||(w[1]=R=>h.value=R),k],clearable:n.clearable,disabled:n.disabled,placeholder:"Стоимость",class:"w-full"},t.createSlots({_:2},[a.value?{name:"suffix",fn:t.withCtx(()=>{var R;return[t.createTextVNode(t.toDisplayString((R=l.value)==null?void 0:R.currency.symbol),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):t.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),yw={class:"text-sm"},bw={class:"text-sm"},_w={},ww=t.defineComponent({..._w,__name:"add-product-to-cart-dialog",emits:["submit"],setup(n,{expose:e,emit:i}){const r=t.useTemplateRef("form-reference"),o=t.useTemplateRef("base-dialog-reference"),s=t.ref(!1),a=t.ref(null),l=t.computed(()=>{var R,O,U;return((R=a.value)==null?void 0:R.unit.isLinear)&&((U=(O=a.value)==null?void 0:O.properties)==null?void 0:U.isLengthConfigurator)}),c=t.computed(()=>a.value?j.UnitsHelper.productIsMeasurable(a.value)||l.value?"шт.":a.value.unit.name:"шт."),d=t.ref(void 0),u=t.ref(void 0),f=t.ref(!0),h=t.ref(null),p=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.quantity)??null},set:R=>{h.value&&(h.value.quantity=R??0)}}),m=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.length)??null},set:R=>{h.value&&(h.value.length=R??void 0)}}),g=R=>{h.value&&(h.value.marker=R??void 0)},b=i,y=()=>({length:{},quantity:{},marker:{}}),_=t.ref(y()),k=t.ref(!1),x=t.computed(()=>{var G,W,D,L;if(!a.value)return{};const R=j.UnitsHelper.getProductLengthMultiplicity(a.value),O=j.UnitsHelper.getProductMultiplicity(a.value),U=((W=(G=a.value)==null?void 0:G.properties)==null?void 0:W.minLength)||R,Q=(L=(D=a.value)==null?void 0:D.properties)==null?void 0:L.maxLength;return{length:[le.required,le.min(U??.1),le.max(Q),le.step(R),He.serverValidation(_.value.length.feedback)],quantity:[le.required,le.min(O),le.step(O),He.serverValidation(_.value.quantity.feedback)],marker:[He.serverValidation(_.value.marker.feedback)]}}),v=t.computed(()=>{var R,O,U;return a.value?((R=a.value.properties)==null?void 0:R.lengthStep)??((O=a.value.properties)!=null&&O.ignoreMinCountCheck?0:((U=a.value.properties)==null?void 0:U.minCount)??0):0}),B=t.computed(()=>{var U,Q,G,W,D,L,z,P,q;if(!a.value)return"";const R=((Q=(U=a.value)==null?void 0:U.properties)==null?void 0:Q.minLength)??((W=(G=a.value)==null?void 0:G.properties)!=null&&W.ignoreMinCountCheck?0:(L=(D=a.value)==null?void 0:D.properties)==null?void 0:L.minCount),O=(P=(z=a.value)==null?void 0:z.properties)==null?void 0:P.maxLength;return R||O?`(${R?`от ${R}`:""}${R&&O?" ":""}${O?`до ${O}`:""} ${(q=a.value)==null?void 0:q.unit.name})`:""}),w=R=>{var W,D;if(!((D=(W=a.value)==null?void 0:W.properties)!=null&&D.isLengthConfigurator)||!h.value||M.isNil(R)||v.value===0)return;const O=R/v.value,U=Math.round(O),Q=j.UnitsHelper.getProductMultiplicity(a.value),G=Math.max(U,Q);h.value.quantity=G},T=R=>{var G,W,D,L;if(!((W=(G=a.value)==null?void 0:G.properties)!=null&&W.isLengthConfigurator)||!h.value||M.isNil(R)||v.value===0)return;const O=R*v.value,U=((D=a.value.properties)==null?void 0:D.minLength)||j.UnitsHelper.getProductLengthMultiplicity(a.value),Q=(L=a.value.properties)==null?void 0:L.maxLength;U!==void 0&&O<U?h.value.length=U:Q!==void 0&&O>Q?h.value.length=Q:h.value.length=O},C=async R=>{var U;const O=M.cloneDeep(h.value);try{await((U=r.value)==null?void 0:U.validate(Q=>{if(!Q){if(!a.value||!O)return;j.UnitsHelper.productIsMeasurable(a.value)||delete O.length,l.value&&v.value&&(O.length=v.value),k.value=!0,b("submit",O,_.value,()=>{k.value=!1,R(!1),t.nextTick(()=>{var G;(G=r.value)==null||G.validate(M.noop).catch(M.noop)})})}}))}catch{}},$=()=>{a.value=null,d.value=void 0,h.value=null,_.value=y()},E=()=>{s.value=!1};return e({show:(R,O)=>{var U,Q,G,W,D;if($(),s.value=!0,a.value=R,d.value=O==null?void 0:O.cartItemData,u.value=O==null?void 0:O.orderId,f.value=(O==null?void 0:O.canSetDopProdaga)??!1,h.value=new j.OrderItemBase((O==null?void 0:O.cartItemData)??new j.OrderItemBase({product:R,quantity:j.UnitsHelper.productIsMeasurable(a.value)?1:((U=R==null?void 0:R.properties)==null?void 0:U.minCount)??1,length:((Q=R==null?void 0:R.properties)==null?void 0:Q.minLength)||((G=R==null?void 0:R.properties)!=null&&G.ignoreMinCountCheck?0:(W=R==null?void 0:R.properties)==null?void 0:W.minCount)||0})),(D=R==null?void 0:R.properties)!=null&&D.isLengthConfigurator&&h.value&&v.value>0){const L=v.value,z=h.value.quantity||1;h.value.length=z*L}},closeDialog:E}),(R,O)=>{var D;const U=F.NFormItem,Q=F.NInputGroupLabel,G=F.NInputGroup,W=F.NCheckbox;return t.openBlock(),t.createBlock(Ps,{ref:"base-dialog-reference",show:s.value,title:`${d.value?"Изменение":"Добавление"} товара ${(D=a.value)==null?void 0:D.name} в ${u.value?` заказ №${u.value}`:"корзину"}`,"accept-button":{show:!0,text:d.value?"Изменить":"Добавить"},processing:k.value,"modal-width":500,onAccept:C,onClosing:E},{default:t.withCtx(()=>[a.value&&h.value?t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{key:0,ref:"form-reference",model:h.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.unref(j.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(U,{key:0,path:"length",label:`Метраж, ${B.value+a.value.unit.name}`},t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:m.value,"onUpdate:value":[O[0]||(O[0]=L=>m.value=L),w],parse:t.unref(ct),step:t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:O[1]||(O[1]=L=>t.unref(ao)(L,".",!1)),onInput:O[2]||(O[2]=L=>t.unref(ot)(_.value,"length")),onFocus:t.unref(Le)},null,8,["value","parse","step","onFocus"])]),_:2},[!_.value.length.feedback&&t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",yw,"Метраж должно быть кратно "+t.toDisplayString(t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):t.createCommentVNode("",!0),t.createVNode(U,{path:"quantity",label:`Количество, ${c.value}`},{default:t.withCtx(()=>[t.createVNode(G,null,t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:p.value,"onUpdate:value":[O[3]||(O[3]=L=>p.value=L),T],parse:t.unref(ct),step:t.unref(j.UnitsHelper).getProductMultiplicity(a.value),"show-button":t.unref(j.UnitsHelper).getProductMultiplicity(a.value)>1,"button-placement":"both",placeholder:"Введите количество",class:"w-full",onKeydown:O[4]||(O[4]=L=>t.unref(ao)(L,".",!1)),onInput:O[5]||(O[5]=L=>t.unref(ot)(_.value,"quantity")),onFocus:t.unref(Le)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(t.openBlock(),t.createBlock(Q,{key:0,class:"bg-orange-100 font-bold"},{default:t.withCtx(()=>[t.createTextVNode(" x "+t.toDisplayString(v.value)+" "+t.toDisplayString(a.value.unit.name),1)]),_:1})):t.createCommentVNode("",!0)]),_:2},[!_.value.quantity.feedback&&t.unref(j.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",bw,"Количество должно быть кратно "+t.toDisplayString(t.unref(j.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1},8,["label"]),t.unref(j.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(U,{key:1,path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:h.value.marker??null,placeholder:"Введите маркировку",onInput:O[6]||(O[6]=L=>t.unref(ot)(_.value,"marker")),"onUpdate:value":O[7]||(O[7]=L=>g(L)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(W,{key:2,checked:h.value.isAdditionalSale,"onUpdate:checked":O[8]||(O[8]=L=>h.value.isAdditionalSale=L),"true-value":!0,"false-value":!1},{default:t.withCtx(()=>[...O[9]||(O[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[t.unref(oi),()=>{var L,z;return(z=(L=o.value)==null?void 0:L.acceptHandler)==null?void 0:z.call(L)}]]):t.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),xw={class:"flex flex-row gap-1"},kw={class:"sc-client-name flex flex-col gap-1 text-base"},Cw=["href"],vw={key:1,class:"text-sc-grey"},Sw={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Bw={key:0},Nw={key:1,class:"text-sm"},Tw={},Ir=t.defineComponent({...Tw,__name:"client-name-with-short-info",props:{client:{},nameLink:{default:void 0},popoverPosition:{default:void 0},showCityAndRegion:{type:Boolean,default:!0},showSalesDirection:{type:Boolean,default:!1},showClientInfoIcon:{type:Boolean,default:!1}},emits:["click:client-name","click:client-info"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>i.client.lastLoginAt?xe.format(i.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{M.isNil(i.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",i.client,a)};return(a,l)=>{const c=lo,d=F.NButton,u=F.NPopover;return t.openBlock(),t.createElementBlock("div",xw,[n.showClientInfoIcon?(t.openBlock(),t.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=f=>a.$emit("click:client-info",n.client))},{default:t.withCtx(()=>[t.createVNode(c)]),_:1})):t.createCommentVNode("",!0),t.createVNode(u,{disabled:t.unref(M.isNil)(n.popoverPosition),placement:n.popoverPosition},{trigger:t.withCtx(()=>[t.createElementVNode("div",kw,[t.createElementVNode("a",{href:n.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=f=>s(f))},[t.createElementVNode("span",{class:t.normalizeClass({"line-through":!n.client.isActive})},t.toDisplayString(n.client.name),3),n.showSalesDirection&&n.client.salesDirection?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"line-through":!n.client.isActive})}," ("+t.toDisplayString(n.client.salesDirection.name)+") ",3)):t.createCommentVNode("",!0),n.client.isActive?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",vw," [ Деактивирован ] "))],8,Cw),n.showCityAndRegion&&n.client.city?(t.openBlock(),t.createElementBlock("span",Sw," г. "+t.toDisplayString(n.client.city.name)+", "+t.toDisplayString(n.client.city.region.name),1)):t.createCommentVNode("",!0)])]),default:t.withCtx(()=>[n.client.alternativeName?(t.openBlock(),t.createElementBlock("div",Bw,t.toDisplayString(n.client.alternativeName),1)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("span",Nw," Последний вход: "+t.toDisplayString(o.value),1)):t.createCommentVNode("",!0),t.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),$w={class:"text-base"},Ew={},Zu=t.defineComponent({...Ew,__name:"contragent-with-short-info",props:{contragent:{}},setup(n){const e=n,i=t.computed(()=>si.getFormatEntityName(e.contragent));return(r,o)=>(t.openBlock(),t.createElementBlock("span",$w,t.toDisplayString(i.value),1))}}),Rw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Pw(n,e){return t.openBlock(),t.createElementBlock("svg",Rw,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)])])}const Fw=t.markRaw({name:"tabler-mail",render:Pw}),Vw=["href"],Mw={},Iw=t.defineComponent({...Mw,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(n){return(e,i)=>{const r=Fw;return t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showEmailIcon})},[n.showEmailIcon?(t.openBlock(),t.createBlock(r,{key:0})):t.createCommentVNode("",!0),t.createElementVNode("a",{href:`mailto:${n.email}`,class:"no-underline"},t.toDisplayString(n.email),9,Vw)],2)}}}),Aw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Ow(n,e){return t.openBlock(),t.createElementBlock("svg",Aw,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M444 49.9C431.3 38.2 379.9.9 265.3.4c0 0-135.1-8.1-200.9 52.3C27.8 89.3 14.9 143 13.5 209.5s-3.1 191.1 117 224.9h.1l-.1 51.6s-.8 20.9 13 25.1c16.6 5.2 26.4-10.7 42.3-27.8c8.7-9.4 20.7-23.2 29.8-33.7c82.2 6.9 145.3-8.9 152.5-11.2c16.6-5.4 110.5-17.4 125.7-142c15.8-128.6-7.6-209.8-49.8-246.5M457.9 287c-12.9 104-89 110.6-103 115.1c-6 1.9-61.5 15.7-131.2 11.2c0 0-52 62.7-68.2 79c-5.3 5.3-11.1 4.8-11-5.7c0-6.9.4-85.7.4-85.7q-.15 0 0 0C43.1 372.7 49.1 266.6 50.2 211.1s11.6-101 42.6-131.6c55.7-50.5 170.4-43 170.4-43c96.9.4 143.3 29.6 154.1 39.4c35.7 30.6 53.9 103.8 40.6 211.1m-139-80.8c.4 8.6-12.5 9.2-12.9.6c-1.1-22-11.4-32.7-32.6-33.9c-8.6-.5-7.8-13.4.7-12.9c27.9 1.5 43.4 17.5 44.8 46.2m20.3 11.3c1-42.4-25.5-75.6-75.8-79.3c-8.5-.6-7.6-13.5.9-12.9c58 4.2 88.9 44.1 87.8 92.5c-.1 8.6-13.1 8.2-12.9-.3m47 13.4c.1 8.6-12.9 8.7-12.9.1c-.6-81.5-54.9-125.9-120.8-126.4c-8.5-.1-8.5-12.9 0-12.9c73.7.5 133 51.4 133.7 139.2M374.9 329v.2c-10.8 19-31 40-51.8 33.3l-.2-.3c-21.1-5.9-70.8-31.5-102.2-56.5c-16.2-12.8-31-27.9-42.4-42.4c-10.3-12.9-20.7-28.2-30.8-46.6c-21.3-38.5-26-55.7-26-55.7c-6.7-20.8 14.2-41 33.3-51.8h.2c9.2-4.8 18-3.2 23.9 3.9c0 0 12.4 14.8 17.7 22.1c5 6.8 11.7 17.7 15.2 23.8c6.1 10.9 2.3 22-3.7 26.6l-12 9.6c-6.1 4.9-5.3 14-5.3 14s17.8 67.3 84.3 84.3c0 0 9.1.8 14-5.3l9.6-12c4.6-6 15.7-9.8 26.6-3.7c14.7 8.3 33.4 21.2 45.8 32.9c7 5.7 8.6 14.4 3.8 23.6"},null,-1)])])}const Qu=t.markRaw({name:"fa6-brands-viber",render:Ow}),zw={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Dw=["id"],Lw=["id"],Hw=["fill"],Ww=["fill"];function jw(n,e){return t.openBlock(),t.createElementBlock("svg",zw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGBRLHCcSy,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)])],8,Dw),t.createElementVNode("linearGradient",{id:n.idMap.SVGHW6lecxh,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[1]||(e[1]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)])],8,Lw)]),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGBRLHCcSy+")",d:"M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004"},null,8,Hw),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGHW6lecxh+")",d:"M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z"},null,8,Ww),e[2]||(e[2]=t.createElementVNode("path",{fill:"#FFF",d:"M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"},null,-1))])}const Ju=t.markRaw({name:"logos-whatsapp-icon",render:jw,setup(){const n=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+n(),SVGHW6lecxh:"uicons-"+n()}}}}),qw={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},Xw=["id"],Yw=["fill"];function Uw(n,e){return t.openBlock(),t.createElementBlock("svg",qw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGuySfwdaH,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)])],8,Xw)]),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGuySfwdaH+")",d:"M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"},null,8,Yw),e[1]||(e[1]=t.createElementVNode("path",{fill:"#FFF",d:"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"},null,-1))])}const ef=t.markRaw({name:"logos-telegram",render:Uw,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),Kw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Gw(n,e){return t.openBlock(),t.createElementBlock("svg",Kw,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M391 480c-19.52 0-46.94-7.06-88-30c-49.93-28-88.55-53.85-138.21-103.38C116.91 298.77 93.61 267.79 61 208.45c-36.84-67-30.56-102.12-23.54-117.13C45.82 73.38 58.16 62.65 74.11 52a176.3 176.3 0 0 1 28.64-15.2c1-.43 1.93-.84 2.76-1.21c4.95-2.23 12.45-5.6 21.95-2c6.34 2.38 12 7.25 20.86 16c18.17 17.92 43 57.83 52.16 77.43c6.15 13.21 10.22 21.93 10.23 31.71c0 11.45-5.76 20.28-12.75 29.81c-1.31 1.79-2.61 3.5-3.87 5.16c-7.61 10-9.28 12.89-8.18 18.05c2.23 10.37 18.86 41.24 46.19 68.51s57.31 42.85 67.72 45.07c5.38 1.15 8.33-.59 18.65-8.47c1.48-1.13 3-2.3 4.59-3.47c10.66-7.93 19.08-13.54 30.26-13.54h.06c9.73 0 18.06 4.22 31.86 11.18c18 9.08 59.11 33.59 77.14 51.78c8.77 8.84 13.66 14.48 16.05 20.81c3.6 9.53.21 17-2 22c-.37.83-.78 1.74-1.21 2.75a176.5 176.5 0 0 1-15.29 28.58c-10.63 15.9-21.4 28.21-39.38 36.58A67.4 67.4 0 0 1 391 480"},null,-1)])])}const tf=t.markRaw({name:"ion-call",render:Gw}),Zw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Qw(n,e){return t.openBlock(),t.createElementBlock("svg",Zw,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2m10 3a2 2 0 0 1 2 2m-2-6a6 6 0 0 1 6 6"},null,-1)])])}const Jw=t.markRaw({name:"tabler-phone-call",render:Qw}),ex={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},tx=["href"],nx=["href"],ix=["href"],rx=["href"],ox={},sx=t.defineComponent({...ox,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{try{return e.phone?xr.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=t.computed(()=>{var l;return M.isString(i.value)?!1:((l=i.value)==null?void 0:l.isValid())??!1}),o=t.computed(()=>{var l;return M.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=t.computed(()=>{var l;return M.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("E.164"))??""}),a=t.ref(!1);return(l,c)=>{const d=Jw,u=tf,f=ef,h=Ju,p=Qu;return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",{class:t.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=m=>a.value=!a.value),onFocusout:c[1]||(c[1]=m=>a.value=!1),onMouseleave:c[2]||(c[2]=m=>a.value=!1)},[t.createElementVNode("div",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showPhoneIcon})},[n.showPhoneIcon?(t.openBlock(),t.createBlock(d,{key:0})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)],2),r.value&&a.value?(t.openBlock(),t.createElementBlock("div",ex,[r.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${s.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[t.createVNode(u)],8,tx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${s.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(f)],8,nx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(h)],8,ix)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[t.createVNode(p)],8,rx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],34)])}}}),ax={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lx(n,e){return t.openBlock(),t.createElementBlock("svg",ax,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)])])}const cx=t.markRaw({name:"mdi-envelope",render:lx}),dx={class:"flex flex-col gap-1"},ux={key:0,class:"mb-2 flex flex-col text-base"},fx={key:0,class:"text-sc-dark-grey text-sm"},hx={key:1,class:"whitespace-nowrap text-sm"},mx={key:2,class:"whitespace-nowrap text-sm"},px={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},gx=["href"],yx=["href"],bx=["href"],_x=["href"],wx=["href"],xx={key:0,class:"flex flex-col text-base"},kx={key:0,class:"text-sc-dark-grey text-sm"},Cx={key:1,class:"mt-2 text-sm"},vx={key:0,class:"-mt-1"},Sx={},Bx=t.defineComponent({...Sx,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(n){const e=n,i=t.computed(()=>si.getFormatEntityName(e.contact)),r=t.computed(()=>{try{return e.contact.phone?xr.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=t.computed(()=>{var d;return M.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=t.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=t.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("E.164"))??""}),l=t.computed(()=>o.value||e.contact.email),c=t.ref(!1);return(d,u)=>{var y,_;const f=tf,h=ef,p=Ju,m=Qu,g=cx,b=F.NPopover;return t.openBlock(),t.createElementBlock("div",dx,[t.createVNode(b,{disabled:n.fullView,placement:"bottom"},{trigger:t.withCtx(()=>{var k,x,v,B;return[t.createElementVNode("div",{class:t.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(k=n.contact)!=null&&k.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${n.classes}`),style:t.normalizeStyle(n.styles),onMouseenter:u[0]||(u[0]=w=>c.value=!0),onFocusin:u[1]||(u[1]=w=>c.value=!0),onMouseleave:u[2]||(u[2]=w=>c.value=!1),onFocusout:u[3]||(u[3]=w=>c.value=!1)},[t.createElementVNode("div",null,[n.fullView&&(n.contact.name||(x=n.contact)!=null&&x.position)?(t.openBlock(),t.createElementBlock("div",ux,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(v=n.contact)!=null&&v.position?(t.openBlock(),t.createElementBlock("span",fx,t.toDisplayString((B=n.contact)==null?void 0:B.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),n.contact.phone?(t.openBlock(),t.createElementBlock("div",hx,t.toDisplayString(s.value),1)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("div",mx,t.toDisplayString(n.contact.email),1)):t.createCommentVNode("",!0),l.value&&c.value?(t.openBlock(),t.createElementBlock("div",px,[o.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${a.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[t.createVNode(f)],8,gx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${a.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(h)],8,yx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(p)],8,bx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${a.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[t.createVNode(m)],8,_x)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("a",{key:4,href:`mailto:${n.contact.email}`,class:"hover:text-3xl"},[t.createVNode(g)],8,wx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])],38)]}),default:t.withCtx(()=>{var k,x,v,B;return[n.contact.name?(t.openBlock(),t.createElementBlock("div",xx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(k=n.contact)!=null&&k.position?(t.openBlock(),t.createElementBlock("span",kx,t.toDisplayString((x=n.contact)==null?void 0:x.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),(v=n.contact)!=null&&v.comment?(t.openBlock(),t.createElementBlock("div",Cx,[u[4]||(u[4]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((B=n.contact)==null?void 0:B.comment),1)])):t.createCommentVNode("",!0)]}),_:1},8,["disabled"]),n.fullView&&((y=n.contact)!=null&&y.comment)?(t.openBlock(),t.createElementBlock("div",vx,[u[5]||(u[5]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((_=n.contact)==null?void 0:_.comment),1)])):t.createCommentVNode("",!0)])}}});class Nx{constructor(e){N(this,"minHeight");N(this,"maxHeights");N(this,"minWidth");N(this,"maxWidths");N(this,"netType");N(this,"color");N(this,"mountType");N(this,"descriptions");N(this,"crossbarCount");N(this,"heightOverlaps");N(this,"widthOverlaps");N(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=xs.objectToSnake(e.descriptions),this.maxHeights=e.maxHeights,this.maxWidths=e.maxWidths,this.minHeight=e.minHeight,this.minWidth=e.minWidth,this.mountType=e.mountType,this.netType=e.netType,this.heightOverlaps=xs.objectToSnake(e.heightOverlaps),this.widthOverlaps=xs.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function Tx(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:n.properties.configuratorSettings!==void 0&&M.isArray(n.products)&&n.products.length>0}const $x={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ex(n,e){return t.openBlock(),t.createElementBlock("svg",$x,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M16 12a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2"},null,-1)])])}const Rx=t.markRaw({name:"mdi-dots-horizontal",render:Ex}),Px={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fx(n,e){return t.openBlock(),t.createElementBlock("svg",Px,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5A6.5 6.5 0 0 0 9.5 3A6.5 6.5 0 0 0 3 9.5A6.5 6.5 0 0 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5l1.5-1.5zm-6 0C7 14 5 12 5 9.5S7 5 9.5 5S14 7 14 9.5S12 14 9.5 14M7 9h5v1H7z"},null,-1)])])}const Vx=t.markRaw({name:"mdi-magnify-minus-outline",render:Fx}),Mx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ix(n,e){return t.openBlock(),t.createElementBlock("svg",Mx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m15.5 14l5 5l-1.5 1.5l-5-5v-.79l-.27-.28A6.47 6.47 0 0 1 9.5 16A6.5 6.5 0 0 1 3 9.5A6.5 6.5 0 0 1 9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27zm-6 0C12 14 14 12 14 9.5S12 5 9.5 5S5 7 5 9.5S7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2z"},null,-1)])])}const Ax=t.markRaw({name:"mdi-magnify-plus-outline",render:Ix}),Ox={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zx(n,e){return t.openBlock(),t.createElementBlock("svg",Ox,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z"},null,-1)])])}const nf=t.markRaw({name:"mdi-chevron-right",render:zx}),Dx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Lx(n,e){return t.openBlock(),t.createElementBlock("svg",Dx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z"},null,-1)])])}const rf=t.markRaw({name:"mdi-chevron-left",render:Lx}),Hx={heightMedium:"40px",paddingMedium:"0 16px",borderRadiusMedium:"10px",fontSizeMedium:"14px",iconSizeMedium:"18px",iconMarginMedium:"8px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},Ar={heightSmall:"36px",paddingSmall:"0 10px",borderRadiusSmall:"8px",iconSizeSmall:"18px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},of="date-range.dialog.mode",sf="date-range.dialog.scale",af="date-range.quick-periods",lf=["thisMonth","lastMonth","thisQuarter","lastQuarter","thisYear","lastYear","fromBeginningOfThisYear"],cf=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Wx=["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],jx=["Пн","Вт","Ср","Чт","Пт","Сб","Вс"],df=new Date(2e3,0,1),Ti=n=>xe.differenceInCalendarDays(n,df),uf=n=>xe.addDays(df,n),ff=(n,e,i)=>{let r=n??void 0,o=e??void 0;return r&&o&&r>o&&(i!=null&&i.from?o=r:i!=null&&i.to?r=o:[r,o]=[o,r]),{from:r?xe.startOfDay(r):void 0,to:o?xe.endOfDay(o):void 0}},Ra=n=>Object.entries(n).map(([e,i])=>({value:e,label:i.label,item:i})),hf=(n,e)=>{const i=Object.entries(n).filter(([,r])=>r.group===e);return e!=="other"?[{type:"group",key:e,children:Ra(Object.fromEntries(i))}]:j.STANDARD_PERIOD_SECTIONS.map(r=>{const o=i.filter(([,s])=>s.section===r.key);return{type:"group",key:r.key,label:r.label,children:Ra(Object.fromEntries(o))}}).filter(r=>r.children.length>0)},mf=(n,e)=>{const i=t.ref(null),r=t.ref(null),o=t.ref(!1),s=t.ref(null),a=(g,b)=>g<=b?[g,b]:[b,g],l=t.computed(()=>o.value&&r.value!==null&&s.value!==null?a(r.value,s.value):i.value!==null?s.value===null?[i.value,i.value]:a(i.value,s.value):n.value),c=(g,b)=>{i.value=null,e(...a(g,b))},d=g=>{i.value===null?(i.value=g,e(g,g)):c(i.value,g)},u=()=>{globalThis.removeEventListener("pointerup",u);const g=r.value;if(g!==null){if(r.value=null,o.value){o.value=!1,s.value!==null&&c(g,s.value);return}d(g)}},f=g=>{r.value=g,o.value=!1,globalThis.addEventListener("pointerup",u)},h=g=>{s.value=g,r.value!==null&&g!==r.value&&(o.value=!0)},p=()=>{s.value=null},m=g=>{const b=l.value;return!b||g<b[0]||g>b[1]?null:g===b[0]||g===b[1]?"bound":"in-range"};return t.onBeforeUnmount(()=>{globalThis.removeEventListener("pointerup",u)}),{activeRange:l,cellPosition:m,pointerDownHandler:f,pointerEnterHandler:h,pointerLeaveHandler:p,selectHandler:d}},qx={class:"flex items-center justify-between gap-2"},Xx={class:"flex items-center gap-2"},Yx={class:"text-center font-semibold"},Ux={class:"grid grid-cols-7 gap-0.5 text-center text-xs text-gray-500"},Kx={class:"grid grid-cols-7 gap-0.5"},Gx=["disabled","onPointerdown","onPointerenter","onKeydown"],Zx={},Qx=t.defineComponent({...Zx,__name:"day-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=42,s=F.useThemeVars(),a=t.computed(()=>({"--sc-primary-color":s.value.primaryColor,"--sc-primary-color-hover":s.value.primaryColorHover,"--sc-primary-color-suppl":s.value.primaryColorSuppl,"--sc-hover-color":s.value.hoverColor})),l=Xe.initRefDependingOnDeviceResolution(1,2,3),c=t.computed(()=>["grid-cols-1","grid-cols-2","grid-cols-3"][l.value-1]),d=y=>xe.subMonths(xe.startOfMonth(y),l.value===3?1:0),u=y=>y&&xe.isValid(y)?y:new Date,f=t.ref(d(u(i.from??i.to))),h=t.computed(()=>{const{from:y,to:_}=i;return!y||!_||!xe.isValid(y)||!xe.isValid(_)?null:[Ti(y),Ti(_)]}),p=mf(h,(y,_)=>{r("select",{from:xe.startOfDay(uf(y)),to:xe.endOfDay(uf(_))})}),m=y=>{const _=xe.subDays(y,(xe.getDay(y)+6)%7);return M.times(o,k=>{const x=xe.addDays(_,k);return{index:Ti(x),day:x.getDate(),isCurrentMonth:xe.isSameMonth(x,y),isToday:xe.isToday(x)}})},g=t.computed(()=>M.times(l.value,y=>{const _=xe.addMonths(f.value,y);return{key:`${_.getFullYear()}-${_.getMonth()}`,title:`${Wx[_.getMonth()]} ${_.getFullYear()}`,cells:m(_)}})),b=y=>{if(!y.isCurrentMonth)return["sc-day--outside"];const _=y.isToday?["sc-day--today"]:[],k=p.cellPosition(y.index);return k&&_.push(`sc-day--${k}`),_};return t.watch(()=>[i.from,i.to],()=>{const y=i.from??i.to;if(!y||!xe.isValid(y))return;const _=`${y.getFullYear()}-${y.getMonth()}`;M.some(g.value,["key",_])||(f.value=d(y))}),(y,_)=>{const k=rf,x=F.NButton,v=nf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(a.value),onPointerleave:_[2]||(_[2]=(...B)=>t.unref(p).pointerLeaveHandler&&t.unref(p).pointerLeaveHandler(...B))},[t.createElementVNode("div",qx,[t.createVNode(x,{size:"small","aria-label":"Предыдущий месяц","theme-overrides":t.unref(Ar),onClick:_[0]||(_[0]=B=>f.value=t.unref(xe.subMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(k)]),_:1},8,["theme-overrides"]),_[3]||(_[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон на календаре",-1)),t.createElementVNode("div",Xx,[t.renderSlot(y.$slots,"actions",{},void 0,!0),t.createVNode(x,{size:"small","aria-label":"Следующий месяц","theme-overrides":t.unref(Ar),onClick:_[1]||(_[1]=B=>f.value=t.unref(xe.addMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(v)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-3",c.value])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,B=>(t.openBlock(),t.createElementBlock("div",{key:B.key,class:"flex flex-col gap-1"},[t.createElementVNode("div",Yx,t.toDisplayString(B.title),1),t.createElementVNode("div",Ux,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(jx),w=>(t.openBlock(),t.createElementBlock("span",{key:w},t.toDisplayString(w),1))),128))]),t.createElementVNode("div",Kx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.cells,w=>(t.openBlock(),t.createElementBlock("button",{key:w.index,type:"button",class:t.normalizeClass(["sc-day h-7 rounded border-0 p-0 text-xs",b(w)]),disabled:!w.isCurrentMonth,onPointerdown:t.withModifiers(T=>t.unref(p).pointerDownHandler(w.index),["prevent"]),onPointerenter:T=>t.unref(p).pointerEnterHandler(w.index),onKeydown:[t.withKeys(t.withModifiers(T=>t.unref(p).selectHandler(w.index),["prevent"]),["enter"]),t.withKeys(t.withModifiers(T=>t.unref(p).selectHandler(w.index),["prevent"]),["space"])]},t.toDisplayString(w.day),43,Gx))),128))])]))),128))],2),_[4]||(_[4]=t.createStaticVNode('<div class="flex flex-wrap items-center gap-x-6 gap-y-1 text-xs text-gray-700" data-v-a41e813d><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата начала</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--in-range" data-v-a41e813d></i>Выбранный период</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата окончания</span></div>',1))],36)}}}),Jx=fn(Qx,[["__scopeId","data-v-a41e813d"]]),ek={class:"flex items-center justify-between gap-2"},tk={class:"flex items-center gap-2"},nk={class:"text-center font-semibold"},ik={class:"grid grid-cols-3 gap-2"},rk=["onPointerdown","onPointerenter","onKeydown"],ok={},sk=t.defineComponent({...ok,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=F.useThemeVars(),s=t.computed(()=>({"--sc-primary-color":o.value.primaryColor,"--sc-primary-color-hover":o.value.primaryColorHover,"--sc-primary-color-suppl":o.value.primaryColorSuppl,"--sc-hover-color":o.value.hoverColor})),a=p=>{const m=new Date().getFullYear();return p&&xe.isValid(p)?p.getFullYear():m},l=t.ref(a(i.from??i.to)),c=Xe.initRefDependingOnDeviceResolution(1,3,3),d=t.computed(()=>c.value===1?[l.value]:[l.value-1,l.value,l.value+1]),u=t.computed(()=>{const{from:p,to:m}=i;return!p||!m||!xe.isValid(p)||!xe.isValid(m)?null:[p.getFullYear()*12+p.getMonth(),m.getFullYear()*12+m.getMonth()]}),f=mf(u,(p,m)=>{r("select",{from:new Date(Math.floor(p/12),p%12,1),to:xe.endOfMonth(new Date(Math.floor(m/12),m%12,1))})}),h=(p,m)=>{const g=f.cellPosition(p*12+m);return g?[`sc-month--${g}`]:[]};return t.watch(()=>[i.from,i.to],()=>{const p=i.from??i.to;if(!p||!xe.isValid(p))return;const m=p.getFullYear();(m<l.value-1||m>l.value+1)&&(l.value=m)}),(p,m)=>{const g=rf,b=F.NButton,y=nf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(s.value),onPointerleave:m[2]||(m[2]=(..._)=>t.unref(f).pointerLeaveHandler&&t.unref(f).pointerLeaveHandler(..._))},[t.createElementVNode("div",ek,[t.createVNode(b,{size:"small","aria-label":"Предыдущий год","theme-overrides":t.unref(Ar),onClick:m[0]||(m[0]=_=>l.value-=1)},{icon:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["theme-overrides"]),m[3]||(m[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон месяцев",-1)),t.createElementVNode("div",tk,[t.renderSlot(p.$slots,"actions",{},void 0,!0),t.createVNode(b,{size:"small","aria-label":"Следующий год","theme-overrides":t.unref(Ar),onClick:m[1]||(m[1]=_=>l.value+=1)},{icon:t.withCtx(()=>[t.createVNode(y)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-4 sm:gap-6",d.value.length===1?"grid-cols-1":"grid-cols-3"])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,_=>(t.openBlock(),t.createElementBlock("div",{key:_,class:"flex flex-col gap-2"},[t.createElementVNode("div",nk,t.toDisplayString(_),1),t.createElementVNode("div",ik,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(cf),(k,x)=>(t.openBlock(),t.createElementBlock("button",{key:k,type:"button",class:t.normalizeClass(["sc-month cursor-pointer rounded-lg px-1 py-2.5 text-sm",h(_,x)]),onPointerdown:t.withModifiers(v=>t.unref(f).pointerDownHandler(_*12+x),["prevent"]),onPointerenter:v=>t.unref(f).pointerEnterHandler(_*12+x),onKeydown:[t.withKeys(t.withModifiers(v=>t.unref(f).selectHandler(_*12+x),["prevent"]),["enter"]),t.withKeys(t.withModifiers(v=>t.unref(f).selectHandler(_*12+x),["prevent"]),["space"])]},t.toDisplayString(k),43,rk))),128))])]))),128))],2)],36)}}}),ak=fn(sk,[["__scopeId","data-v-dd09a19d"]]),lk={class:"sc-date-range-sidebar flex flex-col gap-1"},ck={class:"flex items-center justify-center gap-1"},dk={class:"min-w-12 text-center font-semibold"},uk={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},fk={},hk=t.defineComponent({...fk,__name:"month-year-sidebar",props:{year:{},month:{}},emits:["update:year","select-month","today"],setup(n,{emit:e}){const i=e;return(r,o)=>{const s=F.NButton;return t.openBlock(),t.createElementBlock("div",lk,[t.createElementVNode("div",ck,[t.createVNode(s,{size:"small",quaternary:"",onClick:o[0]||(o[0]=a=>i("update:year",n.year-1))},{default:t.withCtx(()=>[...o[3]||(o[3]=[t.createTextVNode(" ‹ ",-1)])]),_:1}),t.createElementVNode("span",dk,t.toDisplayString(n.year),1),t.createVNode(s,{size:"small",quaternary:"",onClick:o[1]||(o[1]=a=>i("update:year",n.year+1))},{default:t.withCtx(()=>[...o[4]||(o[4]=[t.createTextVNode(" › ",-1)])]),_:1})]),t.createElementVNode("div",uk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(cf),(a,l)=>(t.openBlock(),t.createBlock(s,{key:a,size:"small",quaternary:"",type:l===n.month?"primary":"default",onClick:c=>i("select-month",l)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a),1)]),_:2},1032,["type","onClick"]))),128))]),t.createVNode(s,{size:"small",text:"",type:"info",onClick:o[2]||(o[2]=a=>i("today"))},{default:t.withCtx(()=>[...o[5]||(o[5]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})])}}}),mk={},pf=t.defineComponent({...mk,__name:"date-range-input",props:{clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},value:{default:null},dateFormat:{default:()=>j.useBaseConfigStateStore().config.dateFormats.uiDate}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),s=t.ref(null),a=t.ref(!1),l=t.ref(0),c=t.ref(i.value&&xe.isValid(i.value)?i.value:new Date),d=t.computed(()=>{const k=i.value&&xe.isValid(i.value)?i.value:c.value;return k.getFullYear()===c.value.getFullYear()?k.getMonth():null});let u=0;const f=k=>{var x,v;(v=(x=k.target)==null?void 0:x.closest)!=null&&v.call(x,".n-base-clear__clear")&&(u=performance.now())},h=k=>{k&&performance.now()-u<300||(a.value=k,k&&(c.value=i.value&&xe.isValid(i.value)?i.value:new Date))},p=k=>{r("update:value",k===null?null:new Date(k))},m=(k,x)=>{const v=new Date(k,x,1);if(c.value=v,i.value&&xe.isValid(i.value)){const B=Math.min(xe.getDate(i.value),xe.getDaysInMonth(v));r("update:value",new Date(k,x,B));return}l.value+=1,t.nextTick().then(()=>{var B;return(B=s.value)==null?void 0:B.focus()})},g=(k,x)=>{c.value=xe.addYears(xe.addMonths(c.value,k),x)},b=k=>{m(k,c.value.getMonth())},y=k=>{m(c.value.getFullYear(),k)},_=()=>{a.value=!1,r("update:value",new Date)};return(k,x)=>{const v=F.NButton,B=F.NDatePicker;return t.openBlock(),t.createBlock(B,{ref_key:"pickerReference",ref:s,key:l.value,value:i.value?i.value.getTime():null,show:a.value,clearable:n.clearable,disabled:n.disabled,placeholder:n.placeholder,format:n.dateFormat,actions:[],"default-calendar-start-time":c.value.getTime(),type:"date",class:"w-full min-w-0",onMousedownCapture:f,"onUpdate:show":h,"onUpdate:value":p,onNextMonth:x[0]||(x[0]=w=>g(1,0)),onPrevMonth:x[1]||(x[1]=w=>g(-1,0)),onNextYear:x[2]||(x[2]=w=>g(0,1)),onPrevYear:x[3]||(x[3]=w=>g(0,-1))},{footer:t.withCtx(()=>[t.unref(o)?(t.openBlock(),t.createBlock(v,{key:1,size:"small",text:"",type:"info",onClick:_},{default:t.withCtx(()=>[...x[4]||(x[4]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})):(t.openBlock(),t.createBlock(hk,{key:0,year:c.value.getFullYear(),month:d.value,"onUpdate:year":b,onSelectMonth:y,onToday:_},null,8,["year","month"]))]),_:1},8,["value","show","clearable","disabled","placeholder","format","default-calendar-start-time"])}}}),pk={key:0,class:"text-gray-400"},gk={},gf=t.defineComponent({...gk,__name:"date-range-fields",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},from:{default:null},to:{default:null},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:from","update:to"],setup(n,{emit:e}){const i=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),r=e;return(o,s)=>{var a,l;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["flex w-full min-w-0 gap-1",t.unref(i)?"flex-col":"flex-row items-center"])},[t.createVNode(pf,{value:n.from,clearable:n.clearable,disabled:(a=n.disabled)==null?void 0:a.from,placeholder:n.placeholderFrom,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[0]||(s[0]=c=>r("update:from",c))},null,8,["value","clearable","disabled","placeholder","date-format"]),t.unref(i)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",pk," – ")),t.createVNode(pf,{value:n.to,clearable:n.clearable,disabled:(l=n.disabled)==null?void 0:l.to,placeholder:n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[1]||(s[1]=c=>r("update:to",c))},null,8,["value","clearable","disabled","placeholder","date-format"])],2)}}}),yk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function bk(n,e){return t.openBlock(),t.createElementBlock("svg",yk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M7 11h2v2H7zm14-6v14c0 1.11-.89 2-2 2H5a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h1V1h2v2h8V1h2v2h1a2 2 0 0 1 2 2M5 7h14V5H5zm14 12V9H5v10zm-4-6v-2h2v2zm-4 0v-2h2v2zm-4 2h2v2H7zm8 2v-2h2v2zm-4 0v-2h2v2z"},null,-1)])])}const _k=t.markRaw({name:"mdi-calendar-month-outline",render:bk}),wk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xk(n,e){return t.openBlock(),t.createElementBlock("svg",wk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m16 11.78l4.24-7.33l1.73 1l-5.23 9.05l-6.51-3.75L5.46 19H22v2H2V3h2v14.54L9.5 8z"},null,-1)])])}const kk=t.markRaw({name:"mdi-chart-line",render:xk}),Ck={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function vk(n,e){return t.openBlock(),t.createElementBlock("svg",Ck,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22 21H2V3h2v16h2v-9h4v9h2V6h4v13h2v-5h4z"},null,-1)])])}const Sk=t.markRaw({name:"mdi-chart-bar",render:vk}),Bk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Nk(n,e){return t.openBlock(),t.createElementBlock("svg",Bk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M5 3h1V1h2v2h8V1h2v2h1c1.11 0 2 .89 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m0 16h14V9H5zM5 7h14V5H5zm12 4v2H7v-2z"},null,-1)])])}const Tk=t.markRaw({name:"mdi-calendar-week-outline",render:Nk}),$k={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ek(n,e){return t.openBlock(),t.createElementBlock("svg",$k,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M19 3h-1V1h-2v2H8V1H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2m0 16H5V9h14zm0-12H5V5h14M7 11h5v5H7"},null,-1)])])}const Rk=t.markRaw({name:"mdi-calendar-today-outline",render:Ek}),Pk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fk(n,e){return t.openBlock(),t.createElementBlock("svg",Pk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M12 8a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 2a2 2 0 0 0-2 2a2 2 0 0 0 2 2a2 2 0 0 0 2-2a2 2 0 0 0-2-2m-2 12c-.25 0-.46-.18-.5-.42l-.37-2.65c-.63-.25-1.17-.59-1.69-.99l-2.49 1.01c-.22.08-.49 0-.61-.22l-2-3.46a.493.493 0 0 1 .12-.64l2.11-1.66L4.5 12l.07-1l-2.11-1.63a.493.493 0 0 1-.12-.64l2-3.46c.12-.22.39-.31.61-.22l2.49 1c.52-.39 1.06-.73 1.69-.98l.37-2.65c.04-.24.25-.42.5-.42h4c.25 0 .46.18.5.42l.37 2.65c.63.25 1.17.59 1.69.98l2.49-1c.22-.09.49 0 .61.22l2 3.46c.13.22.07.49-.12.64L19.43 11l.07 1l-.07 1l2.11 1.63c.19.15.25.42.12.64l-2 3.46c-.12.22-.39.31-.61.22l-2.49-1c-.52.39-1.06.73-1.69.98l-.37 2.65c-.04.24-.25.42-.5.42zm1.25-18l-.37 2.61c-1.2.25-2.26.89-3.03 1.78L5.44 7.35l-.75 1.3L6.8 10.2a5.55 5.55 0 0 0 0 3.6l-2.12 1.56l.75 1.3l2.43-1.04c.77.88 1.82 1.52 3.01 1.76l.37 2.62h1.52l.37-2.61c1.19-.25 2.24-.89 3.01-1.77l2.43 1.04l.75-1.3l-2.12-1.55c.4-1.17.4-2.44 0-3.61l2.11-1.55l-.75-1.3l-2.41 1.04a5.42 5.42 0 0 0-3.03-1.77L12.75 4z"},null,-1)])])}const Vk=t.markRaw({name:"mdi-cog-outline",render:Fk}),Mk={class:"grid gap-x-6 gap-y-4 pr-3 sm:grid-cols-2"},Ik={class:"font-medium"},Ak={key:0,class:"pt-1 text-xs text-gray-500"},Ok={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},zk={class:"flex items-center gap-3"},Dk={class:"text-sm text-gray-600"},Lk={class:"flex gap-2"},Hk={},Wk=t.defineComponent({...Hk,__name:"quick-periods-settings",props:{show:{type:Boolean},selectedKeys:{}},emits:["update:show","save"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution("100%","90%","40rem"),s=j.DateTimeProvider.standardPeriods(),a=j.STANDARD_PERIOD_GROUPS.map(u=>({key:u.key,label:u.label,sections:hf(s,u.key)})),l=t.ref([]),c=t.computed(()=>{const u=l.value.length;return`Выбрано: ${u} ${j.pluralize(u,["период","периода","периодов"])}`}),d=()=>{r("save",[...l.value]),r("update:show",!1)};return t.watch(()=>i.show,u=>{u&&(l.value=[...i.selectedKeys])}),(u,f)=>{const h=F.NCheckbox,p=F.NCheckboxGroup,m=F.NScrollbar,g=F.NButton,b=F.NModal;return t.openBlock(),t.createBlock(b,{show:n.show,preset:"card",title:"Настройка быстрого выбора",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":f[4]||(f[4]=y=>r("update:show",y))},{footer:t.withCtx(()=>[t.createElementVNode("div",Ok,[t.createElementVNode("div",zk,[t.createElementVNode("span",Dk,t.toDisplayString(c.value),1),t.createVNode(g,{text:"",type:"info",onClick:f[1]||(f[1]=y=>l.value=[...t.unref(lf)])},{default:t.withCtx(()=>[...f[5]||(f[5]=[t.createTextVNode(" По умолчанию ",-1)])]),_:1}),t.createVNode(g,{text:"",type:"info",disabled:l.value.length===0,onClick:f[2]||(f[2]=y=>l.value=[])},{default:t.withCtx(()=>[...f[6]||(f[6]=[t.createTextVNode(" Снять все ",-1)])]),_:1},8,["disabled"])]),t.createElementVNode("div",Lk,[t.createVNode(g,{type:"primary",onClick:d},{default:t.withCtx(()=>[...f[7]||(f[7]=[t.createTextVNode(" Сохранить ",-1)])]),_:1}),t.createVNode(g,{onClick:f[3]||(f[3]=y=>r("update:show",!1))},{default:t.withCtx(()=>[...f[8]||(f[8]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createVNode(m,{class:"max-h-[60vh]"},{default:t.withCtx(()=>[t.createVNode(p,{value:l.value,"onUpdate:value":f[0]||(f[0]=y=>l.value=y)},{default:t.withCtx(()=>[t.createElementVNode("div",Mk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a),y=>(t.openBlock(),t.createElementBlock("div",{key:y.key,class:"flex flex-col gap-1.5"},[t.createElementVNode("div",Ik,t.toDisplayString(y.label),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.sections,_=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:_.key},[_.label?(t.openBlock(),t.createElementBlock("div",Ak,t.toDisplayString(_.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.children,k=>(t.openBlock(),t.createBlock(h,{key:k.value,value:k.value,label:k.label},null,8,["value","label"]))),128))],64))),128))]))),128))])]),_:1},8,["value"])]),_:1})]),_:1},8,["show","style"])}}}),jk={class:"flex flex-col gap-2"},qk={class:"flex items-center gap-2"},Xk={class:"flex gap-2 px-px pb-4 pt-px"},Yk={key:0,class:"text-sm text-gray-500"},Uk={},Kk=t.defineComponent({...Uk,__name:"quick-periods",props:{from:{},to:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o=j.DateTimeProvider.standardPeriods(),s=()=>{const f=af,h=j.PreferencesStorageProvider.getActualDataFromStorage(f);return(M.isArray(h)?h:lf).filter(m=>M.isString(m)&&m in o)},a=t.ref(s()),l=t.ref(!1),c=t.computed(()=>Object.entries(o).filter(([f])=>a.value.includes(f)).map(([f,h])=>({value:f,label:h.label,item:h,group:h.group}))),d=t.computed(()=>{const f=i.from?Ti(i.from):null,h=i.to?Ti(i.to):null;if(f===null||h===null)return null;const p=c.value.find(m=>{const{from:g,to:b}=m.item;return!g||!b?!1:Ti(g)===f&&Ti(b)===h});return p?String(p.value):null}),u=f=>{a.value=f;const h=af;j.PreferencesStorageProvider.saveActualDataToStorage(h,f,xe.addYears(xe.startOfToday(),1))};return(f,h)=>{const p=Vk,m=F.NButton,g=Rk,b=Tk,y=Sk,_=kk,k=_k,x=F.NScrollbar;return t.openBlock(),t.createElementBlock("div",jk,[t.createElementVNode("div",qk,[h[3]||(h[3]=t.createElementVNode("span",{class:"text-sm font-medium text-gray-700"},"Быстрый выбор",-1)),t.createVNode(m,{size:"tiny",quaternary:"",circle:"","aria-label":"Настроить быстрый выбор",onClick:h[0]||(h[0]=v=>l.value=!0)},{icon:t.withCtx(()=>[t.createVNode(p)]),_:1})]),t.createVNode(x,{"x-scrollable":""},{default:t.withCtx(()=>[t.createElementVNode("div",Xk,[c.value.length===0?(t.openBlock(),t.createElementBlock("span",Yk," Периоды не выбраны ")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,v=>(t.openBlock(),t.createBlock(m,{key:v.value,type:v.value===d.value?"primary":"default",ghost:v.value===d.value,"theme-overrides":t.unref(Hx),class:"shrink-0",onClick:B=>r("apply",v),onMouseenter:B=>r("preview",v),onMouseleave:h[1]||(h[1]=B=>r("preview"))},{icon:t.withCtx(()=>[v.group==="day"?(t.openBlock(),t.createBlock(g,{key:0})):v.group==="week"||v.group==="decade"?(t.openBlock(),t.createBlock(b,{key:1})):v.group==="quarter"||v.group==="halfYear"?(t.openBlock(),t.createBlock(y,{key:2})):v.group==="other"?(t.openBlock(),t.createBlock(_,{key:3})):(t.openBlock(),t.createBlock(k,{key:4}))]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(v.label),1)]),_:2},1032,["type","ghost","theme-overrides","onClick","onMouseenter"]))),128))])]),_:1}),t.createVNode(Wk,{show:l.value,"onUpdate:show":h[2]||(h[2]=v=>l.value=v),"selected-keys":a.value,onSave:u},null,8,["show","selected-keys"])])}}}),Gk={class:"flex flex-col items-stretch gap-3 sm:flex-row"},Zk={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},Qk={class:"flex flex-col items-stretch pr-3"},Jk={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},e2={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},t2={},n2=t.defineComponent({...t2,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o="custom",s=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),a=j.DateTimeProvider.standardPeriods(),l=t.ref(j.STANDARD_PERIOD_GROUPS[0].key),c=t.computed(()=>{const u=j.STANDARD_PERIOD_GROUPS.map(f=>({key:f.key,value:f.key,label:f.label}));return M.isEmpty(i.customPeriods)||u.push({key:o,value:o,label:"Пользовательские"}),u}),d=t.computed(()=>l.value===o?[{type:"group",key:o,children:Ra(i.customPeriods??{})}]:hf(a,l.value));return(u,f)=>{const h=F.NButton,p=F.NScrollbar,m=F.NSelect,g=F.NMenu;return t.openBlock(),t.createElementBlock("div",Gk,[t.createElementVNode("div",Zk,[t.createVNode(p,{class:"max-h-96"},{default:t.withCtx(()=>[t.createElementVNode("div",Qk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,b=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:b.key},[b.label?(t.openBlock(),t.createElementBlock("div",Jk,t.toDisplayString(b.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.children,y=>(t.openBlock(),t.createBlock(h,{key:y.value,size:"small",quaternary:"",type:y.value===n.activeKey?"primary":"default",class:"justify-start",onClick:_=>r("apply",y),onMouseenter:_=>r("preview",y),onMouseleave:f[0]||(f[0]=_=>r("preview"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["type","onClick","onMouseenter"]))),128))],64))),128))])]),_:1})]),t.unref(s)?(t.openBlock(),t.createBlock(m,{key:0,value:l.value,options:c.value,class:"order-1","onUpdate:value":f[1]||(f[1]=b=>l.value=b)},null,8,["value","options"])):(t.openBlock(),t.createElementBlock("div",e2,[t.createVNode(g,{value:l.value,options:c.value,mode:"vertical","onUpdate:value":f[2]||(f[2]=b=>l.value=b)},null,8,["value","options"])]))])}}}),i2={class:"flex flex-col gap-3"},r2={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},o2={key:1,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},s2={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},a2={class:"flex gap-2"},l2={},c2=t.defineComponent({...l2,__name:"date-range-dialog",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},show:{type:Boolean},dateRange:{default:void 0},customPeriods:{default:void 0},dateFormat:{default:void 0}},emits:["update:show","select"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution("100%","90%","48rem"),s=t.ref("custom"),a=t.ref("months"),l=t.computed(()=>a.value==="months"?"Показать по дням":"Показать по месяцам"),c=()=>j.PreferencesStorageProvider.getActualDataFromStorage(of)==="standard"?"standard":"custom",d=()=>j.PreferencesStorageProvider.getActualDataFromStorage(sf)==="days"?"days":"months",u=(C,$)=>{j.PreferencesStorageProvider.saveActualDataToStorage(C,$,xe.addYears(xe.startOfToday(),1))},f=t.ref({}),h=t.ref(null),p=t.ref(null),m=t.computed(()=>h.value??f.value),g=(C,$)=>{var R,O;const E=(R=i.disabled)!=null&&R.from?f.value.from:C,I=(O=i.disabled)!=null&&O.to?f.value.to:$;h.value=null,f.value=ff(E,I,i.disabled)},b=C=>{p.value=null,g(C,f.value.to)},y=C=>{p.value=null,g(f.value.from,C)},_=()=>{p.value=null,g(null,null)},k=C=>{p.value=null,g(C.from,C.to)},x=C=>{const $=C.item;g($.from,$.to),p.value=String(C.value)},v=C=>{const $=C==null?void 0:C.item;h.value=$?{from:$.from,to:$.to}:null},B=()=>{h.value=null,s.value=s.value==="custom"?"standard":"custom",u(of,s.value)},w=()=>{a.value=a.value==="months"?"days":"months",u(sf,a.value)},T=()=>{r("select",f.value),r("update:show",!1)};return t.watch(()=>i.show,C=>{C&&(s.value=c(),a.value=d(),p.value=null,h.value=null,f.value={...i.dateRange})}),(C,$)=>{const E=F.NButton,I=Ax,R=Vx,O=F.NTooltip,U=F.NModal;return t.openBlock(),t.createBlock(U,{show:n.show,preset:"card",title:"Выберите период",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":$[1]||($[1]=Q=>r("update:show",Q))},{footer:t.withCtx(()=>[t.createElementVNode("div",s2,[t.createVNode(E,{text:"",type:"info",onClick:B},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),t.createElementVNode("div",a2,[t.createVNode(E,{type:"primary",onClick:T},{default:t.withCtx(()=>[...$[3]||($[3]=[t.createTextVNode(" Выбрать ",-1)])]),_:1}),t.createVNode(E,{onClick:$[0]||($[0]=Q=>r("update:show",!1))},{default:t.withCtx(()=>[...$[4]||($[4]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createElementVNode("div",i2,[s.value==="custom"?(t.openBlock(),t.createBlock(Kk,{key:0,from:f.value.from,to:f.value.to,onApply:x,onPreview:v},null,8,["from","to"])):t.createCommentVNode("",!0),t.createElementVNode("div",r2,[t.createVNode(gf,{from:m.value.from,to:m.value.to,clearable:n.clearable,disabled:n.disabled,"date-format":n.dateFormat,class:"flex-1","onUpdate:from":b,"onUpdate:to":y},null,8,["from","to","clearable","disabled","date-format"]),n.clearable?(t.openBlock(),t.createBlock(E,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:_},{default:t.withCtx(()=>[...$[2]||($[2]=[t.createTextVNode(" Очистить период ",-1)])]),_:1})):t.createCommentVNode("",!0)]),s.value==="custom"?(t.openBlock(),t.createElementBlock("div",o2,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.value==="months"?ak:Jx),{from:f.value.from,to:f.value.to,onSelect:k},{actions:t.withCtx(()=>[t.createVNode(O,{placement:"top",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(E,{size:"small","aria-label":l.value,"theme-overrides":t.unref(Ar),onClick:w},{icon:t.withCtx(()=>[a.value==="months"?(t.openBlock(),t.createBlock(I,{key:0})):(t.openBlock(),t.createBlock(R,{key:1}))]),_:1},8,["aria-label","theme-overrides"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(l.value),1)]),_:1})]),_:1},40,["from","to"]))])):(t.openBlock(),t.createBlock(n2,{key:2,"active-key":p.value,"custom-periods":n.customPeriods,onApply:x,onPreview:v},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),d2={class:"flex w-full min-w-0 items-center gap-1"},u2={},f2=t.defineComponent({...u2,__name:"date-range",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},dateRange:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:date-range"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.computed(()=>{const u={...i.useDefaultPredefinedDateRanges?j.DateTimeProvider.defaultDateRanges():{},...i.predefinedDateRanges};return M.isEmpty(u)?void 0:u}),a=(u,f)=>{r("update:date-range",ff(u,f,i.disabled))},l=u=>{var f;a(u,(f=i.dateRange)==null?void 0:f.to)},c=u=>{var f;a((f=i.dateRange)==null?void 0:f.from,u)},d=u=>{a(u.from,u.to)};return(u,f)=>{var m,g,b,y;const h=Rx,p=F.NButton;return t.openBlock(),t.createElementBlock("div",d2,[t.createVNode(gf,{from:(m=n.dateRange)==null?void 0:m.from,to:(g=n.dateRange)==null?void 0:g.to,clearable:n.clearable,disabled:n.disabled,"placeholder-from":n.placeholderFrom,"placeholder-to":n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:from":l,"onUpdate:to":c},null,8,["from","to","clearable","disabled","placeholder-from","placeholder-to","date-format"]),t.createVNode(p,{disabled:!!((b=n.disabled)!=null&&b.from&&((y=n.disabled)!=null&&y.to)),title:"Выбрать период","aria-label":"Выбрать период",onClick:f[0]||(f[0]=_=>o.value=!0)},{default:t.withCtx(()=>[t.createVNode(h)]),_:1},8,["disabled"]),t.createVNode(c2,{show:o.value,"onUpdate:show":f[1]||(f[1]=_=>o.value=_),"date-range":n.dateRange,clearable:n.clearable,disabled:n.disabled,"custom-periods":s.value,"date-format":n.dateFormat,onSelect:d},null,8,["show","date-range","clearable","disabled","custom-periods","date-format"])])}}}),h2={class:"sc-lbl-date text-nowrap"},m2={},Ko=t.defineComponent({...m2,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean},isShowTime:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>xe.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=t.computed(()=>xe.format(e.date,"HH:mm"));return(o,s)=>(t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-col":n.isTimeOnSecondLine})},[t.createElementVNode("span",h2,t.toDisplayString(i.value),1),n.isShowTime?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([{"text-sc-grey":n.isTimeSecondary,"ml-1":!n.isTimeOnSecondLine},"sc-lbl-time"])},t.toDisplayString(r.value),3)):t.createCommentVNode("",!0)],2))}}),p2={},g2=t.defineComponent({...p2,__name:"debt",props:{debt:{default:0},showLabel:{type:Boolean,default:!1},wrapAsSmall:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{let r="";return(e.showLabel??!1)&&(e.debt>0?r="Переплата: ":e.debt<0&&(r="Задолженность: ")),r});return(r,o)=>n.debt!==0?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"text-sm":n.wrapAsSmall})},[t.createTextVNode(t.toDisplayString(i.value)+" ",1),t.createElementVNode("span",{class:t.normalizeClass({"text-green-700":n.debt>0,"text-red-700":n.debt<0})},t.toDisplayString(n.debt)+" ₽ ",3)],2)):t.createCommentVNode("",!0)}}),y2={class:"flex flex-row gap-2.5"},b2={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},_2={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},w2={class:"mb-0.5 sm:mb-0 sm:ml-3"},x2={},k2=t.defineComponent({...x2,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(n){return(e,i)=>{const r=Uo,o=F.NButton,s=F.NPopover;return t.openBlock(),t.createElementBlock("div",y2,[t.createElementVNode("div",b2,[t.renderSlot(e.$slots,"main")]),t.createElementVNode("div",null,[t.createElementVNode("div",_2,[t.renderSlot(e.$slots,"extra-buttons"),t.createElementVNode("div",w2,[n.showCloseButton?(t.openBlock(),t.createBlock(s,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(o,{size:"small",type:"error",onClick:i[0]||(i[0]=a=>e.$emit("close"))},{default:t.withCtx(()=>[t.createVNode(r)]),_:1})]),default:t.withCtx(()=>[i[1]||(i[1]=t.createTextVNode(" Закрыть ",-1))]),_:1})):t.createCommentVNode("",!0)])])])])}}}),C2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function v2(n,e){return t.openBlock(),t.createElementBlock("svg",C2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const S2=t.markRaw({name:"ion-checkmark-done-sharp",render:v2}),B2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function N2(n,e){return t.openBlock(),t.createElementBlock("svg",B2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),t.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const T2=t.markRaw({name:"ion-options-outline",render:N2}),$2={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},E2={class:"flex-auto"},R2={class:"sticky top-0 flex flex-none flex-col justify-start gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},P2={class:"flex flex-none flex-col-reverse justify-end gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},F2={},Pa=t.defineComponent({...F2,__name:"inline-view",props:{disabled:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!1},showApplyButton:{type:Boolean,default:!1},showCancelButton:{type:Boolean,default:!1}},emits:["edit","apply","cancel"],setup(n,{emit:e}){const i=e,r=t.ref(!1),o=()=>{i("edit")},s=()=>{r.value=!1},a=()=>{r.value=!0,i("apply",s)},l=()=>{i("cancel",s)};return(c,d)=>{const u=T2,f=F.NButton,h=F.NPopover,p=S2,m=Uo;return t.openBlock(),t.createElementBlock("div",$2,[t.createElementVNode("div",E2,[t.renderSlot(c.$slots,"default")]),t.createElementVNode("div",null,[t.createElementVNode("div",R2,[t.createElementVNode("div",P2,[n.showEditButton?(t.openBlock(),t.createBlock(h,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[0]||(d[0]=t.createTextVNode(" Редактировать данные ",-1))]),_:1})):t.createCommentVNode("",!0),n.showApplyButton?(t.openBlock(),t.createBlock(h,{key:1,disabled:r.value,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"primary",size:"small",onClick:a},{default:t.withCtx(()=>[t.createVNode(p)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[1]||(d[1]=t.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),n.showCancelButton?(t.openBlock(),t.createBlock(h,{key:2,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"error",size:"small",onClick:l},{default:t.withCtx(()=>[t.createVNode(m)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[2]||(d[2]=t.createTextVNode(" Отменить изменения ",-1))]),_:1})):t.createCommentVNode("",!0)]),t.renderSlot(c.$slots,"extra-buttons")])])])}}}),V2={},yf=t.defineComponent({...V2,__name:"inline-editable-item",props:{disabled:{type:Boolean,default:!1},showEditor:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!0}},emits:["editor:apply","editor:cancel"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.showEditor),s=l=>{r("editor:apply",d=>{o.value=!d,l()})},a=l=>{o.value=!1,l(),r("editor:cancel")};return t.onMounted(()=>{t.watch(()=>i.showEditor,l=>{o.value=l})}),(l,c)=>(t.openBlock(),t.createElementBlock("div",null,[o.value?(t.openBlock(),t.createBlock(Pa,{key:1,disabled:n.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:s,onCancel:a},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-editor-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(t.openBlock(),t.createBlock(Pa,{key:0,disabled:n.disabled,"show-edit-button":n.showEditButton,onEdit:c[0]||(c[0]=d=>o.value=!0)},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-viewer-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),M2={key:0,class:"whitespace-pre-line"},I2={key:1,class:"text-sc-dark-grey"},A2={},O2=t.defineComponent({...A2,__name:"comment-editor",props:{disabled:{type:Boolean,default:!1},comment:{default:""}},emits:["update:comment"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.comment);t.watch(()=>o.value,l=>{o.value=l});const s=l=>{r("update:comment",o.value,l)},a=()=>{o.value=i.comment};return(l,c)=>{const d=F.NInput;return t.openBlock(),t.createBlock(yf,{disabled:n.disabled,"onEditor:apply":s,"onEditor:cancel":a},{viewer:t.withCtx(()=>[t.createElementVNode("div",null,[n.comment?(t.openBlock(),t.createElementBlock("span",M2,t.toDisplayString(n.comment),1)):(t.openBlock(),t.createElementBlock("span",I2," - Комментарий отсутствует - "))])]),editor:t.withCtx(()=>[t.createVNode(d,{value:o.value,"onUpdate:value":c[0]||(c[0]=u=>o.value=u),clearable:!0,type:"textarea"},null,8,["value"])]),_:1},8,["disabled"])}}}),z2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function D2(n,e){return t.openBlock(),t.createElementBlock("svg",z2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 176h40a40 40 0 0 1 40 40v208a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V216a40 40 0 0 1 40-40h40"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const L2=t.markRaw({name:"ion-download-outline",render:D2}),H2={},W2=t.defineComponent({...H2,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{},isError:{type:Boolean}},emits:["update:file"],setup(n,{emit:e}){const i=n,r=e,o=t.ref([]),s=t.computed(()=>o.value.map(l=>(l.status=i.isError?"error":"finished",l))),a=l=>{o.value=l;const c={name:"",content:""};if(l.length===0){r("update:file",null);return}const d=l[0];c.name=d.name;const u=new FileReader;u.addEventListener("load",()=>{c.content=u.result??"",r("update:file",c)}),u.readAsDataURL(d.file)};return(l,c)=>{const d=L2;return t.openBlock(),t.createBlock(t.unref(F.NUpload),{"file-list":s.value,"default-upload":!1,max:1,"show-retry-button":!1,action:"",accept:n.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":a},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NUploadDragger),null,{default:t.withCtx(()=>[t.renderSlot(l.$slots,"dragged-area",{},()=>[t.createElementVNode("div",null,[t.createVNode(d,{class:"text-2xl"}),t.createElementVNode("div",null,t.toDisplayString(n.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["file-list","accept"])}}}),j2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function q2(n,e){return t.openBlock(),t.createElementBlock("svg",j2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0 0 80 446.25h340.89a32 32 0 0 0 28.18-47.17m-198.6-1.83a20 20 0 1 1 20-20a20 20 0 0 1-20 20m21.72-201.15l-5.74 122a16 16 0 0 1-32 0l-5.74-121.95a21.73 21.73 0 0 1 21.5-22.69h.21a21.74 21.74 0 0 1 21.73 22.7Z"},null,-1)])])}const X2=t.markRaw({name:"ion-warning",render:q2}),Y2={},U2=t.defineComponent({...Y2,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(n){return(e,i)=>{const r=X2,o=F.NPopover;return t.openBlock(),t.createBlock(o,{disabled:n.popoverText.length===0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(r,{class:t.normalizeClass(`ml-0.5 ${n.iconClass}`)},null,8,["class"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.popoverText),1)]),_:1},8,["disabled"])}}}),K2={},G2=t.defineComponent({...K2,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.value),s=t.computed(()=>t.inject("debounce-input-time",i.debounceTime)),a=M.debounce(()=>r("update:value",o.value),s.value),l=c=>{o.value=c,a()};return t.watch(()=>i.value,c=>{o.value=c}),(c,d)=>(t.openBlock(),t.createBlock(t.unref(F.NInput),{value:o.value,"onUpdate:value":[d[0]||(d[0]=u=>o.value=u),l],clearable:n.clearable,placeholder:n.placeholder},{prefix:t.withCtx(()=>[t.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),Z2={},Q2=t.defineComponent({...Z2,__name:"debounced-input-number",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:500},placeholder:{default:""},min:{default:void 0},max:{default:void 0},step:{default:1},validator:{type:Function,default:void 0},parse:{type:Function,default:void 0},showButton:{type:Boolean,default:!0}},emits:["update:value","keydown","input","focus"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.computed(()=>t.inject("debounce-input-time",r.debounceTime)),l=M.debounce(()=>o("update:value",s.value),a.value),c=p=>{s.value=p,l()};t.watch(()=>r.value,p=>{s.value=p});const d=t.ref(null);return e({focus:()=>{var p;return(p=d.value)==null?void 0:p.focus()},blur:()=>{var p;return(p=d.value)==null?void 0:p.blur()},select:()=>{var p;return(p=d.value)==null?void 0:p.select()}}),(p,m)=>(t.openBlock(),t.createBlock(t.unref(F.NInputNumber),{ref_key:"inputReference",ref:d,value:s.value??null,clearable:n.clearable,parse:n.parse,"show-button":n.showButton,placeholder:n.placeholder,min:n.min,max:n.max,step:n.step,validator:n.validator,"onUpdate:value":c,onKeydown:m[0]||(m[0]=g=>o("keydown",g)),onInput:m[1]||(m[1]=g=>o("input",g)),onFocus:m[2]||(m[2]=g=>o("focus",g))},{prefix:t.withCtx(()=>[t.renderSlot(p.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),J2={},eC=t.defineComponent({...J2,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref((i.value??"").replaceAll(/\D*/g,"")),s=M.debounce(c=>r("update:value",c),i.debounceTime??0),a=c=>{let d="";if(M.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(M.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof xr.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}i.debounceTime?s(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const u=xr.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof xr.ParseError)o.value=d;else throw u}};return t.watch(()=>i.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=o.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),t.onBeforeMount(()=>l(o.value??"")),(c,d)=>(t.openBlock(),t.createBlock(t.unref(Sm.VueTelInput),{modelValue:o.value,"onUpdate:modelValue":[d[0]||(d[0]=u=>o.value=u),a],"auto-default-country":!1,"auto-format":!0,"default-country":n.defaultCountry,disabled:n.disabled,"input-options":{placeholder:n.placeholder},"preferred-countries":n.preferredCountries,"only-countries":n.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),tC=fn(eC,[["__scopeId","data-v-751dbb0e"]]),nC={class:"mb-7 grid grid-cols-2 gap-3.5 lg:grid-cols-4"},iC={class:"mb-2 text-[11.5px] font-semibold uppercase text-gray-500"},rC={},oC=t.defineComponent({...rC,__name:"kpi-grid",props:{items:{},isLoading:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",nC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,r=>(t.openBlock(),t.createElementBlock("div",{key:r.label,class:"rounded-lg border border-solid border-gray-200 px-4 py-4"},[t.createElementVNode("div",iC,t.toDisplayString(r.label),1),t.createElementVNode("div",{class:t.normalizeClass(["text-[25px] font-bold",r.valueClass])},t.toDisplayString(n.isLoading?"…":r.value),3),t.createElementVNode("div",{class:t.normalizeClass(["mt-1.5 text-xs font-medium",r.noteClass])},t.toDisplayString(r.note),3)]))),128))]))}}),sC={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function aC(n,e){return t.openBlock(),t.createElementBlock("svg",sC,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"},null,-1)])])}const lC=t.markRaw({name:"tabler-external-link",render:aC}),cC={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},dC=["href"],uC={},fC=t.defineComponent({...uC,__name:"external-link",props:{text:{},url:{},description:{}},setup(n){return(e,i)=>{const r=lC,o=F.NTooltip;return t.openBlock(),t.createBlock(o,{disabled:t.unref(M.isUndefined)(n.description),placement:"top-start"},{trigger:t.withCtx(()=>[t.createElementVNode("span",cC,[t.createElementVNode("a",{href:n.url,target:"_blank",class:"no-underline"},t.toDisplayString(n.text),9,dC),t.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.description),1)]),_:1},8,["disabled"])}}}),hC={key:1,class:"h-24"},mC={key:2,class:"flex flex-col gap-3"},pC={},gC=t.defineComponent({...pC,__name:"compact-card-list",props:{isLoading:{type:Boolean},isEmpty:{type:Boolean},emptyDescription:{},pagination:{}},emits:["update:page","update:pageSize"],setup(n,{emit:e}){const i=e,r=[20,50,100];return(o,s)=>(t.openBlock(),t.createBlock(t.unref(F.NSpin),{show:n.isLoading},{default:t.withCtx(()=>[!n.isLoading&&n.isEmpty?(t.openBlock(),t.createBlock(t.unref(F.NEmpty),{key:0,description:n.emptyDescription},null,8,["description"])):n.isLoading&&n.isEmpty?(t.openBlock(),t.createElementBlock("div",hC)):(t.openBlock(),t.createElementBlock("div",mC,[t.renderSlot(o.$slots,"default")])),n.pagination&&n.pagination.itemCount>0?(t.openBlock(),t.createBlock(t.unref(F.NPagination),{key:3,class:"mt-4 flex-wrap justify-center gap-y-2",size:"small",page:n.pagination.page,"page-size":n.pagination.pageSize,"item-count":n.pagination.itemCount,"page-slot":n.pagination.pageSlot,"page-sizes":r,"show-size-picker":!0,prefix:t.unref(Ul),"onUpdate:page":s[0]||(s[0]=a=>i("update:page",a)),"onUpdate:pageSize":s[1]||(s[1]=a=>i("update:pageSize",a))},null,8,["page","page-size","item-count","page-slot","prefix"])):t.createCommentVNode("",!0)]),_:3},8,["show"]))}}),yC={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function bC(n,e){return t.openBlock(),t.createElementBlock("svg",yC,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const _C=t.markRaw({name:"ion-remove-circle-outline",render:bC});let Go=[];const bf=new WeakMap;function wC(){Go.forEach(n=>n(...bf.get(n))),Go=[]}function _f(n,...e){bf.set(n,e),!Go.includes(n)&&Go.push(n)===1&&requestAnimationFrame(wC)}function Or(n,e){let{target:i}=n;for(;i;){if(i.dataset&&i.dataset[e]!==void 0)return!0;i=i.parentElement}return!1}function zr(n){return n.composedPath()[0]||null}function Dr(n){return typeof n=="string"?n.endsWith("px")?Number(n.slice(0,n.length-2)):Number(n):n}function Lr(n){if(n!=null)return typeof n=="number"?`${n}px`:n.endsWith("px")?n:`${n}px`}function yn(n,e){const i=n.trim().split(/\s+/g),r={top:i[0]};switch(i.length){case 1:r.right=i[0],r.bottom=i[0],r.left=i[0];break;case 2:r.right=i[1],r.left=i[1],r.bottom=i[0];break;case 3:r.right=i[1],r.bottom=i[2],r.left=i[1];break;case 4:r.right=i[1],r.bottom=i[2],r.left=i[3];break;default:throw new Error("[seemly/getMargin]:"+n+" is not a valid value.")}return e===void 0?r:r[e]}const wf={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#0FF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000",blanchedalmond:"#FFEBCD",blue:"#00F",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#0FF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#F0F",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#0F0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#F0F",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#F00",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFF",whitesmoke:"#F5F5F5",yellow:"#FF0",yellowgreen:"#9ACD32",transparent:"#0000"};function xC(n,e,i){e/=100,i/=100;let r=(o,s=(o+n/60)%6)=>i-i*e*Math.max(Math.min(s,4-s,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function kC(n,e,i){e/=100,i/=100;let r=e*Math.min(i,1-i),o=(s,a=(s+n/30)%12)=>i-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const Pn="^\\s*",Fn="\\s*$",fi="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Qt="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",$i="([0-9A-Fa-f])",Ei="([0-9A-Fa-f]{2})",xf=new RegExp(`${Pn}hsl\\s*\\(${Qt},${fi},${fi}\\)${Fn}`),kf=new RegExp(`${Pn}hsv\\s*\\(${Qt},${fi},${fi}\\)${Fn}`),Cf=new RegExp(`${Pn}hsla\\s*\\(${Qt},${fi},${fi},${Qt}\\)${Fn}`),vf=new RegExp(`${Pn}hsva\\s*\\(${Qt},${fi},${fi},${Qt}\\)${Fn}`),CC=new RegExp(`${Pn}rgb\\s*\\(${Qt},${Qt},${Qt}\\)${Fn}`),vC=new RegExp(`${Pn}rgba\\s*\\(${Qt},${Qt},${Qt},${Qt}\\)${Fn}`),SC=new RegExp(`${Pn}#${$i}${$i}${$i}${Fn}`),BC=new RegExp(`${Pn}#${Ei}${Ei}${Ei}${Fn}`),NC=new RegExp(`${Pn}#${$i}${$i}${$i}${$i}${Fn}`),TC=new RegExp(`${Pn}#${Ei}${Ei}${Ei}${Ei}${Fn}`);function Yt(n){return parseInt(n,16)}function $C(n){try{let e;if(e=Cf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),Pi(e[13])];if(e=xf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${n}.`)}catch(e){throw e}}function EC(n){try{let e;if(e=vf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),Pi(e[13])];if(e=kf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${n}.`)}catch(e){throw e}}function Ri(n){try{let e;if(e=BC.exec(n))return[Yt(e[1]),Yt(e[2]),Yt(e[3]),1];if(e=CC.exec(n))return[Bt(e[1]),Bt(e[5]),Bt(e[9]),1];if(e=vC.exec(n))return[Bt(e[1]),Bt(e[5]),Bt(e[9]),Pi(e[13])];if(e=SC.exec(n))return[Yt(e[1]+e[1]),Yt(e[2]+e[2]),Yt(e[3]+e[3]),1];if(e=TC.exec(n))return[Yt(e[1]),Yt(e[2]),Yt(e[3]),Pi(Yt(e[4])/255)];if(e=NC.exec(n))return[Yt(e[1]+e[1]),Yt(e[2]+e[2]),Yt(e[3]+e[3]),Pi(Yt(e[4]+e[4])/255)];if(n in wf)return Ri(wf[n]);if(xf.test(n)||Cf.test(n)){const[i,r,o,s]=$C(n);return[...kC(i,r,o),s]}else if(kf.test(n)||vf.test(n)){const[i,r,o,s]=EC(n);return[...xC(i,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${n}.`)}catch(e){throw e}}function RC(n){return n>1?1:n<0?0:n}function Fa(n,e,i,r){return`rgba(${Bt(n)}, ${Bt(e)}, ${Bt(i)}, ${RC(r)})`}function Va(n,e,i,r,o){return Bt((n*e*(1-r)+i*r)/o)}function PC(n,e){Array.isArray(n)||(n=Ri(n)),Array.isArray(e)||(e=Ri(e));const i=n[3],r=e[3],o=Pi(i+r-i*r);return Fa(Va(n[0],i,e[0],r,o),Va(n[1],i,e[1],r,o),Va(n[2],i,e[2],r,o),o)}function De(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Ri(n);return typeof e.alpha=="number"?Fa(i,r,o,e.alpha):Fa(i,r,o,s)}function Zo(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Ri(n),{lightness:a=1,alpha:l=1}=e;return FC([i*a,r*a,o*a,s*l])}function Pi(n){const e=Math.round(Number(n)*100)/100;return e>1?1:e<0?0:e}function Qo(n){const e=Math.round(Number(n));return e>=360||e<0?0:e}function Bt(n){const e=Math.round(Number(n));return e>255?255:e<0?0:e}function hi(n){const e=Math.round(Number(n));return e>100?100:e<0?0:e}function FC(n){const[e,i,r]=n;return 3 in n?`rgba(${Bt(e)}, ${Bt(i)}, ${Bt(r)}, ${Pi(n[3])})`:`rgba(${Bt(e)}, ${Bt(i)}, ${Bt(r)}, 1)`}function VC(n=8){return Math.random().toString(16).slice(2,2+n)}function Sf(n){return Array.isArray(n)?n:[n]}const Ma={STOP:"STOP"};function Bf(n,e){const i=e(n);n.children!==void 0&&i!==Ma.STOP&&n.children.forEach(r=>Bf(r,e))}function MC(n,e={}){const{preserveGroup:i=!1}=e,r=[],o=i?a=>{a.isLeaf||(r.push(a.key),s(a.children))}:a=>{a.isLeaf||(a.isGroup||r.push(a.key),s(a.children))};function s(a){a.forEach(o)}return s(n),r}function IC(n,e){const{isLeaf:i}=n;return i!==void 0?i:!e(n)}function AC(n){return n.children}function OC(n){return n.key}function zC(){return!1}function DC(n,e){const{isLeaf:i}=n;return!(i===!1&&!Array.isArray(e(n)))}function LC(n){return n.disabled===!0}function HC(n,e){return n.isLeaf===!1&&!Array.isArray(e(n))}function WC(n,e){if(n.isLeaf===!0){const i=e(n);if(Array.isArray(i)&&i.length>0)return!0}return!1}function Ia(n){var e;return n==null?[]:Array.isArray(n)?n:(e=n.checkedKeys)!==null&&e!==void 0?e:[]}function Aa(n){var e;return n==null||Array.isArray(n)?[]:(e=n.indeterminateKeys)!==null&&e!==void 0?e:[]}function jC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)||i.add(r)}),Array.from(i)}function qC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)&&i.delete(r)}),Array.from(i)}function XC(n){return(n==null?void 0:n.type)==="group"}function YC(n){const e=new Map;return n.forEach((i,r)=>{e.set(i.key,r)}),i=>{var r;return(r=e.get(i))!==null&&r!==void 0?r:null}}class UC extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function KC(n,e,i,r){return Jo(e.concat(n),i,r,!1)}function GC(n,e){const i=new Set;return n.forEach(r=>{const o=e.treeNodeMap.get(r);if(o!==void 0){let s=o.parent;for(;s!==null&&!(s.disabled||i.has(s.key));)i.add(s.key),s=s.parent}}),i}function ZC(n,e,i,r){const o=Jo(e,i,r,!1),s=Jo(n,i,r,!0),a=GC(n,i),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Oa(n,e){const{checkedKeys:i,keysToCheck:r,keysToUncheck:o,indeterminateKeys:s,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=n;if(!a)return r!==void 0?{checkedKeys:jC(i,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:qC(i,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(i),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let f;o!==void 0?f=ZC(o,i,e,d):r!==void 0?f=KC(r,i,e,d):f=Jo(i,e,d,!1);const h=c==="parent",p=c==="child"||l,m=f,g=new Set,b=Math.max.apply(null,Array.from(u.keys()));for(let y=b;y>=0;y-=1){const _=y===0,k=u.get(y);for(const x of k){if(x.isLeaf)continue;const{key:v,shallowLoaded:B}=x;if(p&&B&&x.children.forEach($=>{!$.disabled&&!$.isLeaf&&$.shallowLoaded&&m.has($.key)&&m.delete($.key)}),x.disabled||!B)continue;let w=!0,T=!1,C=!0;for(const $ of x.children){const E=$.key;if(!$.disabled){if(C&&(C=!1),m.has(E))T=!0;else if(g.has(E)){T=!0,w=!1;break}else if(w=!1,T)break}}w&&!C?(h&&x.children.forEach($=>{!$.disabled&&m.has($.key)&&m.delete($.key)}),m.add(v)):T&&g.add(v),_&&p&&m.has(v)&&m.delete(v)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(g)}}function Jo(n,e,i,r){const{treeNodeMap:o,getChildren:s}=e,a=new Set,l=new Set(n);return n.forEach(c=>{const d=o.get(c);d!==void 0&&Bf(d,u=>{if(u.disabled)return Ma.STOP;const{key:f}=u;if(!a.has(f)&&(a.add(f),l.add(f),HC(u.rawNode,s))){if(r)return Ma.STOP;if(!i)throw new UC}})}),l}function QC(n,{includeGroup:e=!1,includeSelf:i=!0},r){var o;const s=r.treeNodeMap;let a=n==null?null:(o=s.get(n))!==null&&o!==void 0?o:null;const l={keyPath:[],treeNodePath:[],treeNode:a};if(a!=null&&a.ignored)return l.treeNode=null,l;for(;a;)!a.ignored&&(e||!a.isGroup)&&l.treeNodePath.push(a),a=a.parent;return l.treeNodePath.reverse(),i||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function JC(n){if(n.length===0)return null;const e=n[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function ev(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o+1)%r]:o===i.length-1?null:i[o+1]}function Nf(n,e,{loop:i=!1,includeDisabled:r=!1}={}){const o=e==="prev"?tv:ev,s={reverse:e==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===n){if(!a)a=!0;else if(!n.disabled&&!n.isGroup){l=n;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const u=za(d,s);u!==null?l=u:c(o(d,i))}else{const u=o(d,!1);if(u!==null)c(u);else{const f=nv(d);f!=null&&f.isGroup?c(o(f,i)):i&&c(o(d,!0))}}}}return c(n),l}function tv(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o-1+r)%r]:o===0?null:i[o-1]}function nv(n){return n.parent}function za(n,e={}){const{reverse:i=!1}=e,{children:r}=n;if(r){const{length:o}=r,s=i?o-1:0,a=i?-1:o,l=i?-1:1;for(let c=s;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const u=za(d,e);if(u!==null)return u}else return d}}return null}const iv={getChild(){return this.ignored?null:za(this)},getParent(){const{parent:n}=this;return n!=null&&n.isGroup?n.getParent():n},getNext(n={}){return Nf(this,"next",n)},getPrev(n={}){return Nf(this,"prev",n)}};function rv(n,e){const i=e?new Set(e):void 0,r=[];function o(s){s.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||i===void 0||i.has(a.key))&&o(a.children)})}return o(n),r}function ov(n,e){const i=n.key;for(;e;){if(e.key===i)return!0;e=e.parent}return!1}var sv={};function Tf(n,e,i,r,o,s=null,a=0){const l=[];return n.forEach((c,d)=>{var u;sv.NODE_ENV!=="production"&&WC(c,o)&&console.error("[treemate]: node",c,"is invalid");const f=Object.create(r);if(f.rawNode=c,f.siblings=l,f.level=a,f.index=d,f.isFirstChild=d===0,f.isLastChild=d+1===n.length,f.parent=s,!f.ignored){const h=o(c);Array.isArray(h)&&(f.children=Tf(h,e,i,r,o,f,a+1))}l.push(f),e.set(f.key,f),i.has(a)||i.set(a,[]),(u=i.get(a))===null||u===void 0||u.push(f)}),l}function av(n,e={}){var i;const r=new Map,o=new Map,{getDisabled:s=LC,getIgnored:a=zC,getIsGroup:l=XC,getKey:c=OC}=e,d=(i=e.getChildren)!==null&&i!==void 0?i:AC,u=e.ignoreEmptyChildren?x=>{const v=d(x);return Array.isArray(v)?v.length?v:null:v}:d,f=Object.assign({get key(){return c(this.rawNode)},get disabled(){return s(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return IC(this.rawNode,u)},get shallowLoaded(){return DC(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return ov(this,x)}},iv),h=Tf(n,r,o,f,u);function p(x){if(x==null)return null;const v=r.get(x);return v&&!v.isGroup&&!v.ignored?v:null}function m(x){if(x==null)return null;const v=r.get(x);return v&&!v.ignored?v:null}function g(x,v){const B=m(x);return B?B.getPrev(v):null}function b(x,v){const B=m(x);return B?B.getNext(v):null}function y(x){const v=m(x);return v?v.getParent():null}function _(x){const v=m(x);return v?v.getChild():null}const k={treeNodes:h,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return rv(h,x)},getNode:p,getPrev:g,getNext:b,getParent:y,getChild:_,getFirstAvailableNode(){return JC(h)},getPath(x,v={}){return QC(x,v,k)},getCheckedKeys(x,v={}){const{cascade:B=!0,leafOnly:w=!1,checkStrategy:T="all",allowNotLoaded:C=!1}=v;return Oa({checkedKeys:Ia(x),indeterminateKeys:Aa(x),cascade:B,leafOnly:w,checkStrategy:T,allowNotLoaded:C},k)},check(x,v,B={}){const{cascade:w=!0,leafOnly:T=!1,checkStrategy:C="all",allowNotLoaded:$=!1}=B;return Oa({checkedKeys:Ia(v),indeterminateKeys:Aa(v),keysToCheck:x==null?[]:Sf(x),cascade:w,leafOnly:T,checkStrategy:C,allowNotLoaded:$},k)},uncheck(x,v,B={}){const{cascade:w=!0,leafOnly:T=!1,checkStrategy:C="all",allowNotLoaded:$=!1}=B;return Oa({checkedKeys:Ia(v),indeterminateKeys:Aa(v),keysToUncheck:x==null?[]:Sf(x),cascade:w,leafOnly:T,checkStrategy:C,allowNotLoaded:$},k)},getNonLeafKeys(x={}){return MC(h,x)}};return k}function es(n){return n.composedPath()[0]}const lv={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function cv(n,e,i){if(n==="mousemoveoutside"){const r=o=>{e.contains(es(o))||i(o)};return{mousemove:r,touchstart:r}}else if(n==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(es(a))},s=a=>{r&&(e.contains(es(a))||i(a))};return{mousedown:o,mouseup:s,touchstart:o,touchend:s}}return console.error(`[evtd/create-trap-handler]: name \`${n}\` is invalid. This could be a bug of evtd.`),{}}function $f(n,e,i){const r=lv[n];let o=r.get(e);o===void 0&&r.set(e,o=new WeakMap);let s=o.get(i);return s===void 0&&o.set(i,s=cv(n,e,i)),s}function dv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=$f(n,e,i);return Object.keys(o).forEach(s=>{At(s,document,o[s],r)}),!0}return!1}function uv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=$f(n,e,i);return Object.keys(o).forEach(s=>{ht(s,document,o[s],r)}),!0}return!1}function fv(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const n=new WeakMap,e=new WeakMap;function i(){n.set(this,!0)}function r(){n.set(this,!0),e.set(this,!0)}function o(w,T,C){const $=w[T];return w[T]=function(){return C.apply(w,arguments),$.apply(w,arguments)},w}function s(w,T){w[T]=Event.prototype[T]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var w;return(w=a.get(this))!==null&&w!==void 0?w:null}function d(w,T){l!==void 0&&Object.defineProperty(w,"currentTarget",{configurable:!0,enumerable:!0,get:T??l.get})}const u={bubble:{},capture:{}},f={};function h(){const w=function(T){const{type:C,eventPhase:$,bubbles:E}=T,I=es(T);if($===2)return;const R=$===1?"capture":"bubble";let O=I;const U=[];for(;O===null&&(O=window),U.push(O),O!==window;)O=O.parentNode||null;const Q=u.capture[C],G=u.bubble[C];if(o(T,"stopPropagation",i),o(T,"stopImmediatePropagation",r),d(T,c),R==="capture"){if(Q===void 0)return;for(let W=U.length-1;W>=0&&!n.has(T);--W){const D=U[W],L=Q.get(D);if(L!==void 0){a.set(T,D);for(const z of L){if(e.has(T))break;z(T)}}if(W===0&&!E&&G!==void 0){const z=G.get(D);if(z!==void 0)for(const P of z){if(e.has(T))break;P(T)}}}}else if(R==="bubble"){if(G===void 0)return;for(let W=0;W<U.length&&!n.has(T);++W){const D=U[W],L=G.get(D);if(L!==void 0){a.set(T,D);for(const z of L){if(e.has(T))break;z(T)}}}}s(T,"stopPropagation"),s(T,"stopImmediatePropagation"),d(T)};return w.displayName="evtdUnifiedHandler",w}function p(){const w=function(T){const{type:C,eventPhase:$}=T;if($!==2)return;const E=f[C];E!==void 0&&E.forEach(I=>I(T))};return w.displayName="evtdUnifiedWindowEventHandler",w}const m=h(),g=p();function b(w,T){const C=u[w];return C[T]===void 0&&(C[T]=new Map,window.addEventListener(T,m,w==="capture")),C[T]}function y(w){return f[w]===void 0&&(f[w]=new Set,window.addEventListener(w,g)),f[w]}function _(w,T){let C=w.get(T);return C===void 0&&w.set(T,C=new Set),C}function k(w,T,C,$){const E=u[T][C];if(E!==void 0){const I=E.get(w);if(I!==void 0&&I.has($))return!0}return!1}function x(w,T){const C=f[w];return!!(C!==void 0&&C.has(T))}function v(w,T,C,$){let E;if(typeof $=="object"&&$.once===!0?E=Q=>{B(w,T,E,$),C(Q)}:E=C,dv(w,T,E,$))return;const R=$===!0||typeof $=="object"&&$.capture===!0?"capture":"bubble",O=b(R,w),U=_(O,T);if(U.has(E)||U.add(E),T===window){const Q=y(w);Q.has(E)||Q.add(E)}}function B(w,T,C,$){if(uv(w,T,C,$))return;const I=$===!0||typeof $=="object"&&$.capture===!0,R=I?"capture":"bubble",O=b(R,w),U=_(O,T);if(T===window&&!k(T,I?"bubble":"capture",w,C)&&x(w,C)){const G=f[w];G.delete(C),G.size===0&&(window.removeEventListener(w,g),f[w]=void 0)}U.has(C)&&U.delete(C),U.size===0&&O.delete(T),O.size===0&&(window.removeEventListener(w,m,R==="capture"),u[R][w]=void 0)}return{on:v,off:B}}const{on:At,off:ht}=fv(),fr="@@mmoContext",hv={mounted(n,{value:e}){n[fr]={handler:void 0},typeof e=="function"&&(n[fr].handler=e,At("mousemoveoutside",n,e))},updated(n,{value:e}){const i=n[fr];typeof e=="function"?i.handler?i.handler!==e&&(ht("mousemoveoutside",n,i.handler),i.handler=e,At("mousemoveoutside",n,e)):(n[fr].handler=e,At("mousemoveoutside",n,e)):i.handler&&(ht("mousemoveoutside",n,i.handler),i.handler=void 0)},unmounted(n){const{handler:e}=n[fr];e&&ht("mousemoveoutside",n,e),n[fr].handler=void 0}},hr="@@coContext",ts={mounted(n,{value:e,modifiers:i}){n[hr]={handler:void 0},typeof e=="function"&&(n[hr].handler=e,At("clickoutside",n,e,{capture:i.capture}))},updated(n,{value:e,modifiers:i}){const r=n[hr];typeof e=="function"?r.handler?r.handler!==e&&(ht("clickoutside",n,r.handler,{capture:i.capture}),r.handler=e,At("clickoutside",n,e,{capture:i.capture})):(n[hr].handler=e,At("clickoutside",n,e,{capture:i.capture})):r.handler&&(ht("clickoutside",n,r.handler,{capture:i.capture}),r.handler=void 0)},unmounted(n,{modifiers:e}){const{handler:i}=n[hr];i&&ht("clickoutside",n,i,{capture:e.capture}),n[hr].handler=void 0}};function mv(n,e){console.error(`[vdirs/${n}]: ${e}`)}class pv{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(e,i){const{elementZIndex:r}=this;if(i!==void 0){e.style.zIndex=`${i}`,r.delete(e);return}const{nextZIndex:o}=this;r.has(e)&&r.get(e)+1===this.nextZIndex||(e.style.zIndex=`${o}`,r.set(e,o),this.nextZIndex=o+1,this.squashState())}unregister(e,i){const{elementZIndex:r}=this;r.has(e)?r.delete(e):i===void 0&&mv("z-index-manager/unregister-element","Element not found when unregistering."),this.squashState()}squashState(){const{elementCount:e}=this;e||(this.nextZIndex=2e3),this.nextZIndex-e>2500&&this.rearrange()}rearrange(){const e=Array.from(this.elementZIndex.entries());e.sort((i,r)=>i[1]-r[1]),this.nextZIndex=2e3,e.forEach(i=>{const r=i[0],o=this.nextZIndex++;`${o}`!==r.style.zIndex&&(r.style.zIndex=`${o}`)})}}const Da=new pv,mr="@@ziContext",Ef={mounted(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i;n[mr]={enabled:!!o,initialized:!1},o&&(Da.ensureZIndex(n,r),n[mr].initialized=!0)},updated(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i,s=n[mr].enabled;o&&!s&&(Da.ensureZIndex(n,r),n[mr].initialized=!0),n[mr].enabled=!!o},unmounted(n,e){if(!n[mr].initialized)return;const{value:i={}}=e,{zIndex:r}=i;Da.unregister(n,r)}};function gv(n){const e=t.ref(!!n.value);if(e.value)return t.readonly(e);const i=t.watch(n,r=>{r&&(e.value=!0,i())});return t.readonly(e)}function an(n){const e=t.computed(n),i=t.ref(e.value);return t.watch(e,r=>{i.value=r}),typeof n=="function"?i:{__v_isRef:!0,get value(){return i.value},set value(r){n.set(r)}}}const yv=typeof window<"u";let pr,Hr;(()=>{var n,e;pr=yv?(e=(n=document)===null||n===void 0?void 0:n.fonts)===null||e===void 0?void 0:e.ready:void 0,Hr=!1,pr!==void 0?pr.then(()=>{Hr=!0}):Hr=!0})();function bv(n){if(Hr)return;let e=!1;t.onMounted(()=>{Hr||pr==null||pr.then(()=>{e||n()})}),t.onBeforeUnmount(()=>{e=!0})}function La(n,e){return t.watch(n,i=>{i!==void 0&&(e.value=i)}),t.computed(()=>n.value===void 0?e.value:n.value)}function ns(){const n=t.ref(!1);return t.onMounted(()=>{n.value=!0}),t.readonly(n)}function Rf(n,e){return t.computed(()=>{for(const i of e)if(n[i]!==void 0)return n[i];return n[e[e.length-1]]})}const _v=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function wv(){return _v}function Ha(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);return r()}function Wa(n,e=!0,i=[]){return n.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&i.push(t.createTextVNode(String(r)));return}if(Array.isArray(r)){Wa(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Wa(r.children,e,i)}else r.type!==t.Comment&&i.push(r)}}),i}function Pf(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);const o=Wa(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${n}]: slot[${i}] should have exactly one child.`)}let mi=null;function Ff(){if(mi===null&&(mi=document.getElementById("v-binder-view-measurer"),mi===null)){mi=document.createElement("div"),mi.id="v-binder-view-measurer";const{style:n}=mi;n.position="fixed",n.left="0",n.right="0",n.top="0",n.bottom="0",n.pointerEvents="none",n.visibility="hidden",document.body.appendChild(mi)}return mi.getBoundingClientRect()}function xv(n,e){const i=Ff();return{top:e,left:n,height:0,width:0,right:i.width-n,bottom:i.height-e}}function ja(n){const e=n.getBoundingClientRect(),i=Ff();return{left:e.left-i.left,top:e.top-i.top,bottom:i.height+i.top-e.bottom,right:i.width+i.left-e.right,width:e.width,height:e.height}}function kv(n){return n.nodeType===9?null:n.parentNode}function Vf(n){if(n===null)return null;const e=kv(n);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:i,overflowX:r,overflowY:o}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(i+o+r))return e}return Vf(e)}const Mf=t.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(n){var e;t.provide("VBinder",(e=t.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const i=t.inject("VBinder",null),r=t.ref(null),o=y=>{r.value=y,i&&n.syncTargetWithParent&&i.setTargetRef(y)};let s=[];const a=()=>{let y=r.value;for(;y=Vf(y),y!==null;)s.push(y);for(const _ of s)At("scroll",_,f,!0)},l=()=>{for(const y of s)ht("scroll",y,f,!0);s=[]},c=new Set,d=y=>{c.size===0&&a(),c.has(y)||c.add(y)},u=y=>{c.has(y)&&c.delete(y),c.size===0&&l()},f=()=>{_f(h)},h=()=>{c.forEach(y=>y())},p=new Set,m=y=>{p.size===0&&At("resize",window,b),p.has(y)||p.add(y)},g=y=>{p.has(y)&&p.delete(y),p.size===0&&ht("resize",window,b)},b=()=>{p.forEach(y=>y())};return t.onBeforeUnmount(()=>{ht("resize",window,b),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:g}},render(){return Ha("binder",this.$slots)}}),If=t.defineComponent({name:"Target",setup(){const{setTargetRef:n,syncTarget:e}=t.inject("VBinder");return{syncTarget:e,setTargetDirective:{mounted:n,updated:n}}},render(){const{syncTarget:n,setTargetDirective:e}=this;return n?t.withDirectives(Pf("follower",this.$slots),[[e]]):Pf("follower",this.$slots)}}),Cv="@css-render/vue3-ssr";function vv(n,e){return`<style cssr-id="${n}">
|
|
104
104
|
${e}
|
|
105
105
|
</style>`}function Sv(n,e,i){const{styles:r,ids:o}=i;o.has(n)||r!==null&&(o.add(n),r.push(vv(n,e)))}const Bv=typeof document<"u";function Fi(){if(Bv)return;const n=t.inject(Cv,null);if(n!==null)return{adapter:(e,i)=>Sv(e,i,n),context:n}}function Af(n,e){console.error(`[vueuc/${n}]: ${e}`)}function Nv(n){let e=0;for(let i=0;i<n.length;++i)n[i]==="&"&&++e;return e}const Of=/\s*,(?![^(]*\))\s*/g,Tv=/\s+/g;function $v(n,e){const i=[];return e.split(Of).forEach(r=>{let o=Nv(r);if(o){if(o===1){n.forEach(a=>{i.push(r.replace("&",a))});return}}else{n.forEach(a=>{i.push((a&&a+" ")+r)});return}let s=[r];for(;o--;){const a=[];s.forEach(l=>{n.forEach(c=>{a.push(l.replace("&",c))})}),s=a}s.forEach(a=>i.push(a))}),i}function Ev(n,e){const i=[];return e.split(Of).forEach(r=>{n.forEach(o=>{i.push((o&&o+" ")+r)})}),i}function Rv(n){let e=[""];return n.forEach(i=>{i=i&&i.trim(),i&&(i.includes("&")?e=$v(e,i):e=Ev(e,i))}),e.join(", ").replace(Tv," ")}function zf(n){if(!n)return;const e=n.parentElement;e&&e.removeChild(n)}function is(n,e){return(e??document.head).querySelector(`style[cssr-id="${n}"]`)}function Pv(n){const e=document.createElement("style");return e.setAttribute("cssr-id",n),e}function rs(n){return n?/^\s*@(s|m)/.test(n):!1}const Fv=/[A-Z]/g;function Df(n){return n.replace(Fv,e=>"-"+e.toLowerCase())}function Vv(n,e=" "){return typeof n=="object"&&n!==null?` {
|
|
106
106
|
`+Object.entries(n).map(i=>e+` ${Df(i[0])}: ${i[1]};`).join(`
|
|
@@ -113,7 +113,7 @@ ${o}
|
|
|
113
113
|
`);return}l=Df(l),c!=null&&a.push(` ${l}${Vv(c)}`)}),n&&a.push("}"),a.join(`
|
|
114
114
|
`)}function qa(n,e,i){n&&n.forEach(r=>{if(Array.isArray(r))qa(r,e,i);else if(typeof r=="function"){const o=r(e);Array.isArray(o)?qa(o,e,i):o&&i(o)}else r&&i(r)})}function Hf(n,e,i,r,o){const s=n.$;let a="";if(!s||typeof s=="string")rs(s)?a=s:e.push(s);else if(typeof s=="function"){const d=s({context:r.context,props:o});rs(d)?a=d:e.push(d)}else if(s.before&&s.before(r.context),!s.$||typeof s.$=="string")rs(s.$)?a=s.$:e.push(s.$);else if(s.$){const d=s.$({context:r.context,props:o});rs(d)?a=d:e.push(d)}const l=Rv(e),c=Lf(l,n.props,r,o);a?i.push(`${a} {`):c.length&&i.push(c),n.children&&qa(n.children,{context:r.context,props:o},d=>{if(typeof d=="string"){const u=Lf(l,{raw:d},r,o);i.push(u)}else Hf(d,e,i,r,o)}),e.pop(),a&&i.push("}"),s&&s.after&&s.after(r.context)}function Iv(n,e,i){const r=[];return Hf(n,[],r,e,i),r.join(`
|
|
115
115
|
|
|
116
|
-
`)}function Xa(n){for(var e=0,i,r=0,o=n.length;o>=4;++r,o-=4)i=n.charCodeAt(r)&255|(n.charCodeAt(++r)&255)<<8|(n.charCodeAt(++r)&255)<<16|(n.charCodeAt(++r)&255)<<24,i=(i&65535)*1540483477+((i>>>16)*59797<<16),i^=i>>>24,e=(i&65535)*1540483477+((i>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(o){case 3:e^=(n.charCodeAt(r+2)&255)<<16;case 2:e^=(n.charCodeAt(r+1)&255)<<8;case 1:e^=n.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}typeof window<"u"&&(window.__cssrContext={});function Av(n,e,i,r){const{els:o}=e;if(i===void 0)o.forEach(zf),e.els=[];else{const s=is(i,r);s&&o.includes(s)&&(zf(s),e.els=o.filter(a=>a!==s))}}function Wf(n,e){n.push(e)}function Ov(n,e,i,r,o,s,a,l,c){let d;if(i===void 0&&(d=e.render(r),i=Xa(d)),c){c.adapter(i,d??e.render(r));return}l===void 0&&(l=document.head);const u=is(i,l);if(u!==null&&!s)return u;const f=u??Pv(i);if(d===void 0&&(d=e.render(r)),f.textContent=d,u!==null)return u;if(a){const h=l.querySelector(`meta[name="${a}"]`);if(h)return l.insertBefore(f,h),Wf(e.els,f),f}return o?l.insertBefore(f,l.querySelector("style, link")):l.appendChild(f),Wf(e.els,f),f}function zv(n){return Iv(this,this.instance,n)}function Dv(n={}){const{id:e,ssr:i,props:r,head:o=!1,force:s=!1,anchorMetaName:a,parent:l}=n;return Ov(this.instance,this,e,r,o,s,a,l,i)}function Lv(n={}){const{id:e,parent:i}=n;Av(this.instance,this,e,i)}const os=function(n,e,i,r){return{instance:n,$:e,props:i,children:r,els:[],render:zv,mount:Dv,unmount:Lv}},Hv=function(n,e,i,r){return Array.isArray(e)?os(n,{$:null},null,e):Array.isArray(i)?os(n,e,null,i):Array.isArray(r)?os(n,e,i,r):os(n,e,i,null)};function jf(n={}){const e={c:((...i)=>Hv(e,...i)),use:(i,...r)=>i.install(e,...r),find:is,context:{},config:n};return e}function Wv(n,e){if(n===void 0)return!1;if(e){const{context:{ids:i}}=e;return i.has(n)}return is(n)!==null}const{c:pi}=jf(),Ya="vueuc-style";function qf(n){return n&-n}class Xf{constructor(e,i){this.l=e,this.min=i;const r=new Array(e+1);for(let o=0;o<e+1;++o)r[o]=0;this.ft=r}add(e,i){if(i===0)return;const{l:r,ft:o}=this;for(e+=1;e<=r;)o[e]+=i,e+=qf(e)}get(e){return this.sum(e+1)-this.sum(e)}sum(e){if(e===void 0&&(e=this.l),e<=0)return 0;const{ft:i,min:r,l:o}=this;if(e>o)throw new Error("[FinweckTree.sum]: `i` is larger than length.");let s=e*r;for(;e>0;)s+=i[e],e-=qf(e);return s}getBound(e){let i=0,r=this.l;for(;r>i;){const o=Math.floor((i+r)/2),s=this.sum(o);if(s>e){r=o;continue}else if(s<e){if(i===o)return this.sum(i+1)<=e?i+1:o;i=o}else return o}return i}}function Yf(n){return typeof n=="string"?document.querySelector(n):n()||null}const jv=t.defineComponent({name:"LazyTeleport",props:{to:{type:[String,Object],default:void 0},disabled:Boolean,show:{type:Boolean,required:!0}},setup(n){return{showTeleport:gv(t.toRef(n,"show")),mergedTo:t.computed(()=>{const{to:e}=n;return e??"body"})}},render(){return this.showTeleport?this.disabled?Ha("lazy-teleport",this.$slots):t.h(t.Teleport,{disabled:this.disabled,to:this.mergedTo},Ha("lazy-teleport",this.$slots)):null}}),ss={top:"bottom",bottom:"top",left:"right",right:"left"},Uf={start:"end",center:"center",end:"start"},Ua={top:"height",bottom:"height",left:"width",right:"width"},qv={"bottom-start":"top left",bottom:"top center","bottom-end":"top right","top-start":"bottom left",top:"bottom center","top-end":"bottom right","right-start":"top left",right:"center left","right-end":"bottom left","left-start":"top right",left:"center right","left-end":"bottom right"},Xv={"bottom-start":"bottom left",bottom:"bottom center","bottom-end":"bottom right","top-start":"top left",top:"top center","top-end":"top right","right-start":"top right",right:"center right","right-end":"bottom right","left-start":"top left",left:"center left","left-end":"bottom left"},Yv={"bottom-start":"right","bottom-end":"left","top-start":"right","top-end":"left","right-start":"bottom","right-end":"top","left-start":"bottom","left-end":"top"},Kf={top:!0,bottom:!1,left:!0,right:!1},Gf={top:"end",bottom:"start",left:"end",right:"start"};function Uv(n,e,i,r,o,s){if(!o||s)return{placement:n,top:0,left:0};const[a,l]=n.split("-");let c=l??"center",d={top:0,left:0};const u=(p,m,g)=>{let b=0,y=0;const _=i[p]-e[m]-e[p];return _>0&&r&&(g?y=Kf[m]?_:-_:b=Kf[m]?_:-_),{left:b,top:y}},f=a==="left"||a==="right";if(c!=="center"){const p=Yv[n],m=ss[p],g=Ua[p];if(i[g]>e[g]){if(e[p]+e[g]<i[g]){const b=(i[g]-e[g])/2;e[p]<b||e[m]<b?e[p]<e[m]?(c=Uf[l],d=u(g,m,f)):d=u(g,p,f):c="center"}}else i[g]<e[g]&&e[m]<0&&e[p]>e[m]&&(c=Uf[l])}else{const p=a==="bottom"||a==="top"?"left":"top",m=ss[p],g=Ua[p],b=(i[g]-e[g])/2;(e[p]<b||e[m]<b)&&(e[p]>e[m]?(c=Gf[p],d=u(g,p,f)):(c=Gf[m],d=u(g,m,f)))}let h=a;return e[a]<i[Ua[a]]&&e[a]<e[ss[a]]&&(h=ss[a]),{placement:c!=="center"?`${h}-${c}`:h,left:d.left,top:d.top}}function Kv(n,e){return e?Xv[n]:qv[n]}function Gv(n,e,i,r,o,s){if(s)switch(n){case"bottom-start":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-100%)"};case"bottom-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-100%)"};case"top-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left)}px`,transform:""};case"top-end":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%)"};case"right-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%)"};case"right-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-100%)"};case"left-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left)}px`,transform:""};case"left-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-100%)"};case"top":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width/2)}px`,transform:"translateX(-50%)"};case"right":return{top:`${Math.round(i.top-e.top+i.height/2)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-50%)"};case"left":return{top:`${Math.round(i.top-e.top+i.height/2)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-50%)"};case"bottom":default:return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width/2)}px`,transform:"translateX(-50%) translateY(-100%)"}}switch(n){case"bottom-start":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:""};case"bottom-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateX(-100%)"};case"top-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateY(-100%)"};case"top-end":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateX(-100%) translateY(-100%)"};case"right-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:""};case"right-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateY(-100%)"};case"left-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateX(-100%)"};case"left-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateX(-100%) translateY(-100%)"};case"top":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width/2+o)}px`,transform:"translateY(-100%) translateX(-50%)"};case"right":return{top:`${Math.round(i.top-e.top+i.height/2+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateY(-50%)"};case"left":return{top:`${Math.round(i.top-e.top+i.height/2+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateY(-50%) translateX(-100%)"};case"bottom":default:return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width/2+o)}px`,transform:"translateX(-50%)"}}}const Zv=pi([pi(".v-binder-follower-container",{position:"absolute",left:"0",right:"0",top:"0",height:"0",pointerEvents:"none",zIndex:"auto"}),pi(".v-binder-follower-content",{position:"absolute",zIndex:"auto"},[pi("> *",{pointerEvents:"all"})])]),Zf=t.defineComponent({name:"Follower",inheritAttrs:!1,props:{show:Boolean,enabled:{type:Boolean,default:void 0},placement:{type:String,default:"bottom"},syncTrigger:{type:Array,default:["resize","scroll"]},to:[String,Object],flip:{type:Boolean,default:!0},internalShift:Boolean,x:Number,y:Number,width:String,minWidth:String,containerClass:String,teleportDisabled:Boolean,zindexable:{type:Boolean,default:!0},zIndex:Number,overlap:Boolean},setup(n){const e=t.inject("VBinder"),i=an(()=>n.enabled!==void 0?n.enabled:n.show),r=t.ref(null),o=t.ref(null),s=()=>{const{syncTrigger:h}=n;h.includes("scroll")&&e.addScrollListener(c),h.includes("resize")&&e.addResizeListener(c)},a=()=>{e.removeScrollListener(c),e.removeResizeListener(c)};t.onMounted(()=>{i.value&&(c(),s())});const l=Fi();Zv.mount({id:"vueuc/binder",head:!0,anchorMetaName:Ya,ssr:l}),t.onBeforeUnmount(()=>{a()}),bv(()=>{i.value&&c()});const c=()=>{if(!i.value)return;const h=r.value;if(h===null)return;const p=e.targetRef,{x:m,y:g,overlap:b}=n,y=m!==void 0&&g!==void 0?xv(m,g):ja(p);h.style.setProperty("--v-target-width",`${Math.round(y.width)}px`),h.style.setProperty("--v-target-height",`${Math.round(y.height)}px`);const{width:_,minWidth:k,placement:x,internalShift:v,flip:B}=n;h.setAttribute("v-placement",x),b?h.setAttribute("v-overlap",""):h.removeAttribute("v-overlap");const{style:w}=h;_==="target"?w.width=`${y.width}px`:_!==void 0?w.width=_:w.width="",k==="target"?w.minWidth=`${y.width}px`:k!==void 0?w.minWidth=k:w.minWidth="";const T=ja(h),C=ja(o.value),{left:$,top:E,placement:I}=Uv(x,y,T,v,B,b),R=Kv(I,b),{left:O,top:U,transform:Q}=Gv(I,C,y,E,$,b);h.setAttribute("v-placement",I),h.style.setProperty("--v-offset-left",`${Math.round($)}px`),h.style.setProperty("--v-offset-top",`${Math.round(E)}px`),h.style.transform=`translateX(${O}) translateY(${U}) ${Q}`,h.style.setProperty("--v-transform-origin",R),h.style.transformOrigin=R};t.watch(i,h=>{h?(s(),d()):a()});const d=()=>{t.nextTick().then(c).catch(h=>console.error(h))};["placement","x","y","internalShift","flip","width","overlap","minWidth"].forEach(h=>{t.watch(t.toRef(n,h),c)}),["teleportDisabled"].forEach(h=>{t.watch(t.toRef(n,h),d)}),t.watch(t.toRef(n,"syncTrigger"),h=>{h.includes("resize")?e.addResizeListener(c):e.removeResizeListener(c),h.includes("scroll")?e.addScrollListener(c):e.removeScrollListener(c)});const u=ns(),f=an(()=>{const{to:h}=n;if(h!==void 0)return h;u.value});return{VBinder:e,mergedEnabled:i,offsetContainerRef:o,followerRef:r,mergedTo:f,syncPosition:c}},render(){return t.h(jv,{show:this.show,to:this.mergedTo,disabled:this.teleportDisabled},{default:()=>{var n,e;const i=t.h("div",{class:["v-binder-follower-container",this.containerClass],ref:"offsetContainerRef"},[t.h("div",{class:"v-binder-follower-content",ref:"followerRef"},(e=(n=this.$slots).default)===null||e===void 0?void 0:e.call(n))]);return this.zindexable?t.withDirectives(i,[[Ef,{enabled:this.mergedEnabled,zIndex:this.zIndex}]]):i}})}});var Vi=[],Qv=function(){return Vi.some(function(n){return n.activeTargets.length>0})},Jv=function(){return Vi.some(function(n){return n.skippedTargets.length>0})},Qf="ResizeObserver loop completed with undelivered notifications.",eS=function(){var n;typeof ErrorEvent=="function"?n=new ErrorEvent("error",{message:Qf}):(n=document.createEvent("Event"),n.initEvent("error",!1,!1),n.message=Qf),window.dispatchEvent(n)},Wr;(function(n){n.BORDER_BOX="border-box",n.CONTENT_BOX="content-box",n.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Wr||(Wr={}));var Mi=function(n){return Object.freeze(n)},tS=(function(){function n(e,i){this.inlineSize=e,this.blockSize=i,Mi(this)}return n})(),Jf=(function(){function n(e,i,r,o){return this.x=e,this.y=i,this.width=r,this.height=o,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Mi(this)}return n.prototype.toJSON=function(){var e=this,i=e.x,r=e.y,o=e.top,s=e.right,a=e.bottom,l=e.left,c=e.width,d=e.height;return{x:i,y:r,top:o,right:s,bottom:a,left:l,width:c,height:d}},n.fromRect=function(e){return new n(e.x,e.y,e.width,e.height)},n})(),Ka=function(n){return n instanceof SVGElement&&"getBBox"in n},eh=function(n){if(Ka(n)){var e=n.getBBox(),i=e.width,r=e.height;return!i&&!r}var o=n,s=o.offsetWidth,a=o.offsetHeight;return!(s||a||n.getClientRects().length)},th=function(n){var e;if(n instanceof Element)return!0;var i=(e=n==null?void 0:n.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(i&&n instanceof i.Element)},nS=function(n){switch(n.tagName){case"INPUT":if(n.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},jr=typeof window<"u"?window:{},as=new WeakMap,nh=/auto|scroll/,iS=/^tb|vertical/,rS=/msie|trident/i.test(jr.navigator&&jr.navigator.userAgent),Vn=function(n){return parseFloat(n||"0")},gr=function(n,e,i){return n===void 0&&(n=0),e===void 0&&(e=0),i===void 0&&(i=!1),new tS((i?e:n)||0,(i?n:e)||0)},ih=Mi({devicePixelContentBoxSize:gr(),borderBoxSize:gr(),contentBoxSize:gr(),contentRect:new Jf(0,0,0,0)}),rh=function(n,e){if(e===void 0&&(e=!1),as.has(n)&&!e)return as.get(n);if(eh(n))return as.set(n,ih),ih;var i=getComputedStyle(n),r=Ka(n)&&n.ownerSVGElement&&n.getBBox(),o=!rS&&i.boxSizing==="border-box",s=iS.test(i.writingMode||""),a=!r&&nh.test(i.overflowY||""),l=!r&&nh.test(i.overflowX||""),c=r?0:Vn(i.paddingTop),d=r?0:Vn(i.paddingRight),u=r?0:Vn(i.paddingBottom),f=r?0:Vn(i.paddingLeft),h=r?0:Vn(i.borderTopWidth),p=r?0:Vn(i.borderRightWidth),m=r?0:Vn(i.borderBottomWidth),g=r?0:Vn(i.borderLeftWidth),b=f+d,y=c+u,_=g+p,k=h+m,x=l?n.offsetHeight-k-n.clientHeight:0,v=a?n.offsetWidth-_-n.clientWidth:0,B=o?b+_:0,w=o?y+k:0,T=r?r.width:Vn(i.width)-B-v,C=r?r.height:Vn(i.height)-w-x,$=T+b+v+_,E=C+y+x+k,I=Mi({devicePixelContentBoxSize:gr(Math.round(T*devicePixelRatio),Math.round(C*devicePixelRatio),s),borderBoxSize:gr($,E,s),contentBoxSize:gr(T,C,s),contentRect:new Jf(f,c,T,C)});return as.set(n,I),I},oh=function(n,e,i){var r=rh(n,i),o=r.borderBoxSize,s=r.contentBoxSize,a=r.devicePixelContentBoxSize;switch(e){case Wr.DEVICE_PIXEL_CONTENT_BOX:return a;case Wr.BORDER_BOX:return o;default:return s}},oS=(function(){function n(e){var i=rh(e);this.target=e,this.contentRect=i.contentRect,this.borderBoxSize=Mi([i.borderBoxSize]),this.contentBoxSize=Mi([i.contentBoxSize]),this.devicePixelContentBoxSize=Mi([i.devicePixelContentBoxSize])}return n})(),sh=function(n){if(eh(n))return 1/0;for(var e=0,i=n.parentNode;i;)e+=1,i=i.parentNode;return e},sS=function(){var n=1/0,e=[];Vi.forEach(function(a){if(a.activeTargets.length!==0){var l=[];a.activeTargets.forEach(function(d){var u=new oS(d.target),f=sh(d.target);l.push(u),d.lastReportedSize=oh(d.target,d.observedBox),f<n&&(n=f)}),e.push(function(){a.callback.call(a.observer,l,a.observer)}),a.activeTargets.splice(0,a.activeTargets.length)}});for(var i=0,r=e;i<r.length;i++){var o=r[i];o()}return n},ah=function(n){Vi.forEach(function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach(function(o){o.isActive()&&(sh(o.target)>n?i.activeTargets.push(o):i.skippedTargets.push(o))})})},aS=function(){var n=0;for(ah(n);Qv();)n=sS(),ah(n);return Jv()&&eS(),n>0},Ga,lh=[],lS=function(){return lh.splice(0).forEach(function(n){return n()})},cS=function(n){if(!Ga){var e=0,i=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return lS()}).observe(i,r),Ga=function(){i.textContent="".concat(e?e--:e++)}}lh.push(n),Ga()},dS=function(n){cS(function(){requestAnimationFrame(n)})},ls=0,uS=function(){return!!ls},fS=250,hS={attributes:!0,characterData:!0,childList:!0,subtree:!0},ch=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],dh=function(n){return n===void 0&&(n=0),Date.now()+n},Za=!1,mS=(function(){function n(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return n.prototype.run=function(e){var i=this;if(e===void 0&&(e=fS),!Za){Za=!0;var r=dh(e);dS(function(){var o=!1;try{o=aS()}finally{if(Za=!1,e=r-dh(),!uS())return;o?i.run(1e3):e>0?i.run(e):i.start()}})}},n.prototype.schedule=function(){this.stop(),this.run()},n.prototype.observe=function(){var e=this,i=function(){return e.observer&&e.observer.observe(document.body,hS)};document.body?i():jr.addEventListener("DOMContentLoaded",i)},n.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),ch.forEach(function(i){return jr.addEventListener(i,e.listener,!0)}))},n.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),ch.forEach(function(i){return jr.removeEventListener(i,e.listener,!0)}),this.stopped=!0)},n})(),Qa=new mS,uh=function(n){!ls&&n>0&&Qa.start(),ls+=n,!ls&&Qa.stop()},pS=function(n){return!Ka(n)&&!nS(n)&&getComputedStyle(n).display==="inline"},gS=(function(){function n(e,i){this.target=e,this.observedBox=i||Wr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return n.prototype.isActive=function(){var e=oh(this.target,this.observedBox,!0);return pS(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},n})(),yS=(function(){function n(e,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=i}return n})(),cs=new WeakMap,fh=function(n,e){for(var i=0;i<n.length;i+=1)if(n[i].target===e)return i;return-1},ds=(function(){function n(){}return n.connect=function(e,i){var r=new yS(e,i);cs.set(e,r)},n.observe=function(e,i,r){var o=cs.get(e),s=o.observationTargets.length===0;fh(o.observationTargets,i)<0&&(s&&Vi.push(o),o.observationTargets.push(new gS(i,r&&r.box)),uh(1),Qa.schedule())},n.unobserve=function(e,i){var r=cs.get(e),o=fh(r.observationTargets,i),s=r.observationTargets.length===1;o>=0&&(s&&Vi.splice(Vi.indexOf(r),1),r.observationTargets.splice(o,1),uh(-1))},n.disconnect=function(e){var i=this,r=cs.get(e);r.observationTargets.slice().forEach(function(o){return i.unobserve(e,o.target)}),r.activeTargets.splice(0,r.activeTargets.length)},n})(),bS=(function(){function n(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");ds.connect(this,e)}return n.prototype.observe=function(e,i){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!th(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ds.observe(this,e,i)},n.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!th(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ds.unobserve(this,e)},n.prototype.disconnect=function(){ds.disconnect(this)},n.toString=function(){return"function ResizeObserver () { [polyfill code] }"},n})();class _S{constructor(){this.handleResize=this.handleResize.bind(this),this.observer=new(typeof window<"u"&&window.ResizeObserver||bS)(this.handleResize),this.elHandlersMap=new Map}handleResize(e){for(const i of e){const r=this.elHandlersMap.get(i.target);r!==void 0&&r(i)}}registerHandler(e,i){this.elHandlersMap.set(e,i),this.observer.observe(e)}unregisterHandler(e){this.elHandlersMap.has(e)&&(this.elHandlersMap.delete(e),this.observer.unobserve(e))}}const qr=new _S,us=t.defineComponent({name:"ResizeObserver",props:{onResize:Function},setup(n){let e=!1;const i=t.getCurrentInstance().proxy;function r(o){const{onResize:s}=n;s!==void 0&&s(o)}t.onMounted(()=>{const o=i.$el;if(o===void 0){Af("resize-observer","$el does not exist.");return}if(o.nextElementSibling!==o.nextSibling&&o.nodeType===3&&o.nodeValue!==""){Af("resize-observer","$el can not be observed (it may be a text node).");return}o.nextElementSibling!==null&&(qr.registerHandler(o.nextElementSibling,r),e=!0)}),t.onBeforeUnmount(()=>{e&&qr.unregisterHandler(i.$el.nextElementSibling)})},render(){return t.renderSlot(this.$slots,"default")}});let fs;function wS(){return typeof document>"u"?!1:(fs===void 0&&("matchMedia"in window?fs=window.matchMedia("(pointer:coarse)").matches:fs=!1),fs)}let Ja;function hh(){return typeof document>"u"?1:(Ja===void 0&&(Ja="chrome"in window?window.devicePixelRatio:1),Ja)}const mh="VVirtualListXScroll";function xS({columnsRef:n,renderColRef:e,renderItemWithColsRef:i}){const r=t.ref(0),o=t.ref(0),s=t.computed(()=>{const d=n.value;if(d.length===0)return null;const u=new Xf(d.length,0);return d.forEach((f,h)=>{u.add(h,f.width)}),u}),a=an(()=>{const d=s.value;return d!==null?Math.max(d.getBound(o.value)-1,0):0}),l=d=>{const u=s.value;return u!==null?u.sum(d):0},c=an(()=>{const d=s.value;return d!==null?Math.min(d.getBound(o.value+r.value)+1,n.value.length-1):0});return t.provide(mh,{startIndexRef:a,endIndexRef:c,columnsRef:n,renderColRef:e,renderItemWithColsRef:i,getLeft:l}),{listWidthRef:r,scrollLeftRef:o}}const ph=t.defineComponent({name:"VirtualListRow",props:{index:{type:Number,required:!0},item:{type:Object,required:!0}},setup(){const{startIndexRef:n,endIndexRef:e,columnsRef:i,getLeft:r,renderColRef:o,renderItemWithColsRef:s}=t.inject(mh);return{startIndex:n,endIndex:e,columns:i,renderCol:o,renderItemWithCols:s,getLeft:r}},render(){const{startIndex:n,endIndex:e,columns:i,renderCol:r,renderItemWithCols:o,getLeft:s,item:a}=this;if(o!=null)return o({itemIndex:this.index,startColIndex:n,endColIndex:e,allColumns:i,item:a,getLeft:s});if(r!=null){const l=[];for(let c=n;c<=e;++c){const d=i[c];l.push(r({column:d,left:s(c),item:a}))}return l}return null}}),kS=pi(".v-vl",{maxHeight:"inherit",height:"100%",overflow:"auto",minWidth:"1px"},[pi("&:not(.v-vl--show-scrollbar)",{scrollbarWidth:"none"},[pi("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb",{width:0,height:0,display:"none"})])]),CS=t.defineComponent({name:"VirtualList",inheritAttrs:!1,props:{showScrollbar:{type:Boolean,default:!0},columns:{type:Array,default:()=>[]},renderCol:Function,renderItemWithCols:Function,items:{type:Array,default:()=>[]},itemSize:{type:Number,required:!0},itemResizable:Boolean,itemsStyle:[String,Object],visibleItemsTag:{type:[String,Object],default:"div"},visibleItemsProps:Object,ignoreItemResize:Boolean,onScroll:Function,onWheel:Function,onResize:Function,defaultScrollKey:[Number,String],defaultScrollIndex:Number,keyField:{type:String,default:"key"},paddingTop:{type:[Number,String],default:0},paddingBottom:{type:[Number,String],default:0}},setup(n){const e=Fi();kS.mount({id:"vueuc/virtual-list",head:!0,anchorMetaName:Ya,ssr:e}),t.onMounted(()=>{const{defaultScrollIndex:R,defaultScrollKey:O}=n;R!=null?b({index:R}):O!=null&&b({key:O})});let i=!1,r=!1;t.onActivated(()=>{if(i=!1,!r){r=!0;return}b({top:p.value,left:a.value})}),t.onDeactivated(()=>{i=!0,r||(r=!0)});const o=an(()=>{if(n.renderCol==null&&n.renderItemWithCols==null||n.columns.length===0)return;let R=0;return n.columns.forEach(O=>{R+=O.width}),R}),s=t.computed(()=>{const R=new Map,{keyField:O}=n;return n.items.forEach((U,Q)=>{R.set(U[O],Q)}),R}),{scrollLeftRef:a,listWidthRef:l}=xS({columnsRef:t.toRef(n,"columns"),renderColRef:t.toRef(n,"renderCol"),renderItemWithColsRef:t.toRef(n,"renderItemWithCols")}),c=t.ref(null),d=t.ref(void 0),u=new Map,f=t.computed(()=>{const{items:R,itemSize:O,keyField:U}=n,Q=new Xf(R.length,O);return R.forEach((G,W)=>{const D=G[U],L=u.get(D);L!==void 0&&Q.add(W,L)}),Q}),h=t.ref(0),p=t.ref(0),m=an(()=>Math.max(f.value.getBound(p.value-Dr(n.paddingTop))-1,0)),g=t.computed(()=>{const{value:R}=d;if(R===void 0)return[];const{items:O,itemSize:U}=n,Q=m.value,G=Math.min(Q+Math.ceil(R/U+1),O.length-1),W=[];for(let D=Q;D<=G;++D)W.push(O[D]);return W}),b=(R,O)=>{if(typeof R=="number"){x(R,O,"auto");return}const{left:U,top:Q,index:G,key:W,position:D,behavior:L,debounce:z=!0}=R;if(U!==void 0||Q!==void 0)x(U,Q,L);else if(G!==void 0)k(G,L,z);else if(W!==void 0){const P=s.value.get(W);P!==void 0&&k(P,L,z)}else D==="bottom"?x(0,Number.MAX_SAFE_INTEGER,L):D==="top"&&x(0,0,L)};let y,_=null;function k(R,O,U){const{value:Q}=f,G=Q.sum(R)+Dr(n.paddingTop);if(!U)c.value.scrollTo({left:0,top:G,behavior:O});else{y=R,_!==null&&window.clearTimeout(_),_=window.setTimeout(()=>{y=void 0,_=null},16);const{scrollTop:W,offsetHeight:D}=c.value;if(G>W){const L=Q.get(R);G+L<=W+D||c.value.scrollTo({left:0,top:G+L-D,behavior:O})}else c.value.scrollTo({left:0,top:G,behavior:O})}}function x(R,O,U){c.value.scrollTo({left:R,top:O,behavior:U})}function v(R,O){var U,Q,G;if(i||n.ignoreItemResize||I(O.target))return;const{value:W}=f,D=s.value.get(R),L=W.get(D),z=(G=(Q=(U=O.borderBoxSize)===null||U===void 0?void 0:U[0])===null||Q===void 0?void 0:Q.blockSize)!==null&&G!==void 0?G:O.contentRect.height;if(z===L)return;z-n.itemSize===0?u.delete(R):u.set(R,z-n.itemSize);const q=z-L;if(q===0)return;W.add(D,q);const K=c.value;if(K!=null){if(y===void 0){const J=W.sum(D);K.scrollTop>J&&K.scrollBy(0,q)}else if(D<y)K.scrollBy(0,q);else if(D===y){const J=W.sum(D);z+J>K.scrollTop+K.offsetHeight&&K.scrollBy(0,q)}E()}h.value++}const B=!wS();let w=!1;function T(R){var O;(O=n.onScroll)===null||O===void 0||O.call(n,R),(!B||!w)&&E()}function C(R){var O;if((O=n.onWheel)===null||O===void 0||O.call(n,R),B){const U=c.value;if(U!=null){if(R.deltaX===0&&(U.scrollTop===0&&R.deltaY<=0||U.scrollTop+U.offsetHeight>=U.scrollHeight&&R.deltaY>=0))return;R.preventDefault(),U.scrollTop+=R.deltaY/hh(),U.scrollLeft+=R.deltaX/hh(),E(),w=!0,_f(()=>{w=!1})}}}function $(R){if(i||I(R.target))return;if(n.renderCol==null&&n.renderItemWithCols==null){if(R.contentRect.height===d.value)return}else if(R.contentRect.height===d.value&&R.contentRect.width===l.value)return;d.value=R.contentRect.height,l.value=R.contentRect.width;const{onResize:O}=n;O!==void 0&&O(R)}function E(){const{value:R}=c;R!=null&&(p.value=R.scrollTop,a.value=R.scrollLeft)}function I(R){let O=R;for(;O!==null;){if(O.style.display==="none")return!0;O=O.parentElement}return!1}return{listHeight:d,listStyle:{overflow:"auto"},keyToIndex:s,itemsStyle:t.computed(()=>{const{itemResizable:R}=n,O=Lr(f.value.sum());return h.value,[n.itemsStyle,{boxSizing:"content-box",width:Lr(o.value),height:R?"":O,minHeight:R?O:"",paddingTop:Lr(n.paddingTop),paddingBottom:Lr(n.paddingBottom)}]}),visibleItemsStyle:t.computed(()=>(h.value,{transform:`translateY(${Lr(f.value.sum(m.value))})`})),viewportItems:g,listElRef:c,itemsElRef:t.ref(null),scrollTo:b,handleListResize:$,handleListScroll:T,handleListWheel:C,handleItemResize:v}},render(){const{itemResizable:n,keyField:e,keyToIndex:i,visibleItemsTag:r}=this;return t.h(us,{onResize:this.handleListResize},{default:()=>{var o,s;return t.h("div",t.mergeProps(this.$attrs,{class:["v-vl",this.showScrollbar&&"v-vl--show-scrollbar"],onScroll:this.handleListScroll,onWheel:this.handleListWheel,ref:"listElRef"}),[this.items.length!==0?t.h("div",{ref:"itemsElRef",class:"v-vl-items",style:this.itemsStyle},[t.h(r,Object.assign({class:"v-vl-visible-items",style:this.visibleItemsStyle},this.visibleItemsProps),{default:()=>{const{renderCol:a,renderItemWithCols:l}=this;return this.viewportItems.map(c=>{const d=c[e],u=i.get(d),f=a!=null?t.h(ph,{index:u,item:c}):void 0,h=l!=null?t.h(ph,{index:u,item:c}):void 0,p=this.$slots.default({item:c,renderedCols:f,renderedItemWithCols:h,index:u})[0];return n?t.h(us,{key:d,onResize:m=>this.handleItemResize(d,m)},{default:()=>p}):(p.key=d,p)})}})]):(s=(o=this.$slots).empty)===null||s===void 0?void 0:s.call(o)])}})}}),Xn="v-hidden",vS=pi("[v-hidden]",{display:"none!important"}),gh=t.defineComponent({name:"Overflow",props:{getCounter:Function,getTail:Function,updateCounter:Function,onUpdateCount:Function,onUpdateOverflow:Function},setup(n,{slots:e}){const i=t.ref(null),r=t.ref(null);function o(a){const{value:l}=i,{getCounter:c,getTail:d}=n;let u;if(c!==void 0?u=c():u=r.value,!l||!u)return;u.hasAttribute(Xn)&&u.removeAttribute(Xn);const{children:f}=l;if(a.showAllItemsBeforeCalculate)for(const k of f)k.hasAttribute(Xn)&&k.removeAttribute(Xn);const h=l.offsetWidth,p=[],m=e.tail?d==null?void 0:d():null;let g=m?m.offsetWidth:0,b=!1;const y=l.children.length-(e.tail?1:0);for(let k=0;k<y-1;++k){if(k<0)continue;const x=f[k];if(b){x.hasAttribute(Xn)||x.setAttribute(Xn,"");continue}else x.hasAttribute(Xn)&&x.removeAttribute(Xn);const v=x.offsetWidth;if(g+=v,p[k]=v,g>h){const{updateCounter:B}=n;for(let w=k;w>=0;--w){const T=y-1-w;B!==void 0?B(T):u.textContent=`${T}`;const C=u.offsetWidth;if(g-=p[w],g+C<=h||w===0){b=!0,k=w-1,m&&(k===-1?(m.style.maxWidth=`${h-C}px`,m.style.boxSizing="border-box"):m.style.maxWidth="");const{onUpdateCount:$}=n;$&&$(T);break}}}}const{onUpdateOverflow:_}=n;b?_!==void 0&&_(!0):(_!==void 0&&_(!1),u.setAttribute(Xn,""))}const s=Fi();return vS.mount({id:"vueuc/overflow",head:!0,anchorMetaName:Ya,ssr:s}),t.onMounted(()=>o({showAllItemsBeforeCalculate:!1})),{selfRef:i,counterRef:r,sync:o}},render(){const{$slots:n}=this;return t.nextTick(()=>this.sync({showAllItemsBeforeCalculate:!1})),t.h("div",{class:"v-overflow",ref:"selfRef"},[t.renderSlot(n,"default"),n.counter?n.counter():t.h("span",{style:{display:"inline-block"},ref:"counterRef"}),n.tail?n.tail():null])}});function yh(n){return n instanceof HTMLElement}function bh(n){for(let e=0;e<n.childNodes.length;e++){const i=n.childNodes[e];if(yh(i)&&(wh(i)||bh(i)))return!0}return!1}function _h(n){for(let e=n.childNodes.length-1;e>=0;e--){const i=n.childNodes[e];if(yh(i)&&(wh(i)||_h(i)))return!0}return!1}function wh(n){if(!SS(n))return!1;try{n.focus({preventScroll:!0})}catch{}return document.activeElement===n}function SS(n){if(n.tabIndex>0||n.tabIndex===0&&n.getAttribute("tabIndex")!==null)return!0;if(n.getAttribute("disabled"))return!1;switch(n.nodeName){case"A":return!!n.href&&n.rel!=="ignore";case"INPUT":return n.type!=="hidden"&&n.type!=="file";case"SELECT":case"TEXTAREA":return!0;default:return!1}}let Xr=[];const BS=t.defineComponent({name:"FocusTrap",props:{disabled:Boolean,active:Boolean,autoFocus:{type:Boolean,default:!0},onEsc:Function,initialFocusTo:[String,Function],finalFocusTo:[String,Function],returnFocusOnDeactivated:{type:Boolean,default:!0}},setup(n){const e=VC(),i=t.ref(null),r=t.ref(null);let o=!1,s=!1;const a=typeof document>"u"?null:document.activeElement;function l(){return Xr[Xr.length-1]===e}function c(b){var y;b.code==="Escape"&&l()&&((y=n.onEsc)===null||y===void 0||y.call(n,b))}t.onMounted(()=>{t.watch(()=>n.active,b=>{b?(f(),At("keydown",document,c)):(ht("keydown",document,c),o&&h())},{immediate:!0})}),t.onBeforeUnmount(()=>{ht("keydown",document,c),o&&h()});function d(b){if(!s&&l()){const y=u();if(y===null||y.contains(zr(b)))return;p("first")}}function u(){const b=i.value;if(b===null)return null;let y=b;for(;y=y.nextSibling,!(y===null||y instanceof Element&&y.tagName==="DIV"););return y}function f(){var b;if(!n.disabled){if(Xr.push(e),n.autoFocus){const{initialFocusTo:y}=n;y===void 0?p("first"):(b=Yf(y))===null||b===void 0||b.focus({preventScroll:!0})}o=!0,document.addEventListener("focus",d,!0)}}function h(){var b;if(n.disabled||(document.removeEventListener("focus",d,!0),Xr=Xr.filter(_=>_!==e),l()))return;const{finalFocusTo:y}=n;y!==void 0?(b=Yf(y))===null||b===void 0||b.focus({preventScroll:!0}):n.returnFocusOnDeactivated&&a instanceof HTMLElement&&(s=!0,a.focus({preventScroll:!0}),s=!1)}function p(b){if(l()&&n.active){const y=i.value,_=r.value;if(y!==null&&_!==null){const k=u();if(k==null||k===_){s=!0,y.focus({preventScroll:!0}),s=!1;return}s=!0;const x=b==="first"?bh(k):_h(k);s=!1,x||(s=!0,y.focus({preventScroll:!0}),s=!1)}}}function m(b){if(s)return;const y=u();y!==null&&(b.relatedTarget!==null&&y.contains(b.relatedTarget)?p("last"):p("first"))}function g(b){s||(b.relatedTarget!==null&&b.relatedTarget===i.value?p("last"):p("first"))}return{focusableStartRef:i,focusableEndRef:r,focusableStyle:"position: absolute; height: 0; width: 0;",handleStartFocus:m,handleEndFocus:g}},render(){const{default:n}=this.$slots;if(n===void 0)return null;if(this.disabled)return n();const{active:e,focusableStyle:i}=this;return t.h(t.Fragment,null,[t.h("div",{"aria-hidden":"true",tabindex:e?"0":"-1",ref:"focusableStartRef",style:i,onFocus:this.handleStartFocus}),n(),t.h("div",{"aria-hidden":"true",style:i,ref:"focusableEndRef",tabindex:e?"0":"-1",onFocus:this.handleEndFocus})])}});function ET(n){return n}const el="n-internal-select-menu",xh="n-internal-select-menu-body",kh="n-drawer-body",Ch="n-modal-body",vh="n-popover-body",Sh="__disabled__";function Yn(n){const e=t.inject(Ch,null),i=t.inject(kh,null),r=t.inject(vh,null),o=t.inject(xh,null),s=t.ref();if(typeof document<"u"){s.value=document.fullscreenElement;const a=()=>{s.value=document.fullscreenElement};t.onMounted(()=>{At("fullscreenchange",document,a)}),t.onBeforeUnmount(()=>{ht("fullscreenchange",document,a)})}return an(()=>{var a;const{to:l}=n;return l!==void 0?l===!1?Sh:l===!0?s.value||"body":l:e!=null&&e.value?(a=e.value.$el)!==null&&a!==void 0?a:e.value:i!=null&&i.value?i.value:r!=null&&r.value?r.value:o!=null&&o.value?o.value:l??(s.value||"body")})}Yn.tdkey=Sh,Yn.propTo={type:[String,Object,Boolean],default:void 0};function NS(n){const e={isDeactivated:!1};let i=!1;return t.onActivated(()=>{if(e.isDeactivated=!1,!i){i=!0;return}n()}),t.onDeactivated(()=>{e.isDeactivated=!0,i||(i=!0)}),e}function Bh(n,e){e&&(t.onMounted(()=>{const{value:i}=n;i&&qr.registerHandler(i,e)}),t.watch(n,(i,r)=>{r&&qr.unregisterHandler(r)},{deep:!1}),t.onBeforeUnmount(()=>{const{value:i}=n;i&&qr.unregisterHandler(i)}))}function Nh(n){return n.replace(/#|\(|\)|,|\s|\./g,"_")}const TS=/^(\d|\.)+$/,Th=/(\d|\.)+/;function tl(n,{c:e=1,offset:i=0,attachPx:r=!0}={}){if(typeof n=="number"){const o=(n+i)*e;return o===0?"0":`${o}px`}else if(typeof n=="string")if(TS.test(n)){const o=(Number(n)+i)*e;return r?o===0?"0":`${o}px`:`${o}`}else{const o=Th.exec(n);return o?n.replace(Th,String((Number(o[0])+i)*e)):n}return n}function $h(n){const{left:e,right:i,top:r,bottom:o}=yn(n);return`${r} ${e} ${o} ${i}`}var Eh={};function $S(n){let e=".",i="__",r="--",o;if(n){let m=n.blockPrefix;m&&(e=m),m=n.elementPrefix,m&&(i=m),m=n.modifierPrefix,m&&(r=m)}const s={install(m){o=m.c;const g=m.context;g.bem={},g.bem.b=null,g.bem.els=null}};function a(m){let g,b;return{before(y){g=y.bem.b,b=y.bem.els,y.bem.els=null},after(y){y.bem.b=g,y.bem.els=b},$({context:y,props:_}){return m=typeof m=="string"?m:m({context:y,props:_}),y.bem.b=m,`${(_==null?void 0:_.bPrefix)||e}${y.bem.b}`}}}function l(m){let g;return{before(b){g=b.bem.els},after(b){b.bem.els=g},$({context:b,props:y}){return m=typeof m=="string"?m:m({context:b,props:y}),b.bem.els=m.split(",").map(_=>_.trim()),b.bem.els.map(_=>`${(y==null?void 0:y.bPrefix)||e}${b.bem.b}${i}${_}`).join(", ")}}}function c(m){return{$({context:g,props:b}){m=typeof m=="string"?m:m({context:g,props:b});const y=m.split(",").map(x=>x.trim());function _(x){return y.map(v=>`&${(b==null?void 0:b.bPrefix)||e}${g.bem.b}${x!==void 0?`${i}${x}`:""}${r}${v}`).join(", ")}const k=g.bem.els;if(k!==null){if(Eh.NODE_ENV!=="production"&&k.length>=2)throw Error(`[css-render/plugin-bem]: m(${m}) is invalid, using modifier inside multiple elements is not allowed`);return _(k[0])}else return _()}}}function d(m){return{$({context:g,props:b}){m=typeof m=="string"?m:m({context:g,props:b});const y=g.bem.els;if(Eh.NODE_ENV!=="production"&&y!==null&&y.length>=2)throw Error(`[css-render/plugin-bem]: notM(${m}) is invalid, using modifier inside multiple elements is not allowed`);return`&:not(${(b==null?void 0:b.bPrefix)||e}${g.bem.b}${y!==null&&y.length>0?`${i}${y[0]}`:""}${r}${m})`}}}return Object.assign(s,{cB:((...m)=>o(a(m[0]),m[1],m[2])),cE:((...m)=>o(l(m[0]),m[1],m[2])),cM:((...m)=>o(c(m[0]),m[1],m[2])),cNotM:((...m)=>o(d(m[0]),m[1],m[2]))}),s}const ES=".n-",RS="__",PS="--",Rh=jf(),Ph=$S({blockPrefix:ES,elementPrefix:RS,modifierPrefix:PS});Rh.use(Ph);const{c:he,find:PT}=Rh,{cB:_e,cE:ve,cM:Fe,cNotM:bn}=Ph,FS=(...n)=>he(">",[_e(...n)]);function nt(n,e){return n+(e==="default"?"":e.replace(/^[a-z]/,i=>i.toUpperCase()))}let nl;function VS(){return nl===void 0&&(nl=navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),nl}const MS=new WeakSet;function IS(n){MS.add(n)}function Fh(n){switch(typeof n){case"string":return n||void 0;case"number":return String(n);default:return}}const Vh=new Set;function gi(n,e){const i=`[naive/${n}]: ${e}`;Vh.has(i)||(Vh.add(i),console.error(i))}function Mh(n,e){console.error(`[naive/${n}]: ${e}`)}function Ih(n,e){throw new Error(`[naive/${n}]: ${e}`)}function Nt(n,...e){if(Array.isArray(n))n.forEach(i=>Nt(i,...e));else return n(...e)}function il(n,e=!0,i=[]){return n.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&i.push(t.createTextVNode(String(r)));return}if(Array.isArray(r)){il(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&il(r.children,e,i)}else{if(r.type===t.Comment&&e)return;i.push(r)}}}),i}function AS(n,e="default",i=void 0){const r=n[e];if(!r)return Mh("getFirstSlotVNode",`slot[${e}] is empty`),null;const o=il(r(i));return o.length===1?o[0]:(Mh("getFirstSlotVNode",`slot[${e}] should have exactly one child`),null)}function OS(n,e=[],i){const r={};return e.forEach(o=>{r[o]=n[o]}),Object.assign(r,i)}function rl(n){const e=n.filter(i=>i!==void 0);if(e.length!==0)return e.length===1?e[0]:i=>{n.forEach(r=>{r&&r(i)})}}function yr(n,...e){return typeof n=="function"?n(...e):typeof n=="string"?t.createTextVNode(n):typeof n=="number"?t.createTextVNode(String(n)):null}function hs(n){return n.some(e=>t.isVNode(e)?!(e.type===t.Comment||e.type===t.Fragment&&!hs(e.children)):!0)?n:null}function ol(n,e){return n&&hs(n())||e()}function Ii(n,e){const i=n&&hs(n());return e(i||null)}function Ah(n){return!(n&&hs(n()))}const sl=t.defineComponent({render(){var n,e;return(e=(n=this.$slots).default)===null||e===void 0?void 0:e.call(n)}}),Ai="n-config-provider",zS="n";function Oi(n={},e={defaultBordered:!0}){const i=t.inject(Ai,null);return{inlineThemeDisabled:i==null?void 0:i.inlineThemeDisabled,mergedRtlRef:i==null?void 0:i.mergedRtlRef,mergedComponentPropsRef:i==null?void 0:i.mergedComponentPropsRef,mergedBreakpointsRef:i==null?void 0:i.mergedBreakpointsRef,mergedBorderedRef:t.computed(()=>{var r,o;const{bordered:s}=n;return s!==void 0?s:(o=(r=i==null?void 0:i.mergedBorderedRef.value)!==null&&r!==void 0?r:e.defaultBordered)!==null&&o!==void 0?o:!0}),mergedClsPrefixRef:i?i.mergedClsPrefixRef:t.shallowRef(zS),namespaceRef:t.computed(()=>i==null?void 0:i.mergedNamespaceRef.value)}}function zi(n,e,i,r){i||Ih("useThemeClass","cssVarsRef is not passed");const o=t.inject(Ai,null),s=o==null?void 0:o.mergedThemeHashRef,a=o==null?void 0:o.styleMountTarget,l=t.ref(""),c=Fi();let d;const u=`__${n}`,f=()=>{let h=u;const p=e?e.value:void 0,m=s==null?void 0:s.value;m&&(h+=`-${m}`),p&&(h+=`-${p}`);const{themeOverrides:g,builtinThemeOverrides:b}=r;g&&(h+=`-${Xa(JSON.stringify(g))}`),b&&(h+=`-${Xa(JSON.stringify(b))}`),l.value=h,d=()=>{const y=i.value;let _="";for(const k in y)_+=`${k}: ${y[k]};`;he(`.${h}`,_).mount({id:h,ssr:c,parent:a}),d=void 0}};return t.watchEffect(()=>{f()}),{themeClass:l,onRender:()=>{d==null||d()}}}const Oh="n-form-item";function DS(n,{defaultSize:e="medium",mergedSize:i,mergedDisabled:r}={}){const o=t.inject(Oh,null);t.provide(Oh,null);const s=t.computed(i?()=>i(o):()=>{const{size:c}=n;if(c)return c;if(o){const{mergedSize:d}=o;if(d.value!==void 0)return d.value}return e}),a=t.computed(r?()=>r(o):()=>{const{disabled:c}=n;return c!==void 0?c:o?o.disabled.value:!1}),l=t.computed(()=>{const{status:c}=n;return c||(o==null?void 0:o.mergedValidationStatus.value)});return t.onBeforeUnmount(()=>{o&&o.restoreValidation()}),{mergedSizeRef:s,mergedDisabledRef:a,mergedStatusRef:l,nTriggerFormBlur(){o&&o.handleContentBlur()},nTriggerFormChange(){o&&o.handleContentChange()},nTriggerFormFocus(){o&&o.handleContentFocus()},nTriggerFormInput(){o&&o.handleContentInput()}}}const LS={name:"en-US",global:{undo:"Undo",redo:"Redo",confirm:"Confirm",clear:"Clear"},Popconfirm:{positiveText:"Confirm",negativeText:"Cancel"},Cascader:{placeholder:"Please Select",loading:"Loading",loadingRequiredMessage:n=>`Please load all ${n}'s descendants before checking it.`},Time:{dateFormat:"yyyy-MM-dd",dateTimeFormat:"yyyy-MM-dd HH:mm:ss"},DatePicker:{yearFormat:"yyyy",monthFormat:"MMM",dayFormat:"eeeeee",yearTypeFormat:"yyyy",monthTypeFormat:"yyyy-MM",dateFormat:"yyyy-MM-dd",dateTimeFormat:"yyyy-MM-dd HH:mm:ss",quarterFormat:"yyyy-qqq",weekFormat:"YYYY-w",clear:"Clear",now:"Now",confirm:"Confirm",selectTime:"Select Time",selectDate:"Select Date",datePlaceholder:"Select Date",datetimePlaceholder:"Select Date and Time",monthPlaceholder:"Select Month",yearPlaceholder:"Select Year",quarterPlaceholder:"Select Quarter",weekPlaceholder:"Select Week",startDatePlaceholder:"Start Date",endDatePlaceholder:"End Date",startDatetimePlaceholder:"Start Date and Time",endDatetimePlaceholder:"End Date and Time",startMonthPlaceholder:"Start Month",endMonthPlaceholder:"End Month",monthBeforeYear:!0,firstDayOfWeek:6,today:"Today"},DataTable:{checkTableAll:"Select all in the table",uncheckTableAll:"Unselect all in the table",confirm:"Confirm",clear:"Clear"},LegacyTransfer:{sourceTitle:"Source",targetTitle:"Target"},Transfer:{selectAll:"Select all",unselectAll:"Unselect all",clearAll:"Clear",total:n=>`Total ${n} items`,selected:n=>`${n} items selected`},Empty:{description:"No Data"},Select:{placeholder:"Please Select"},TimePicker:{placeholder:"Select Time",positiveText:"OK",negativeText:"Cancel",now:"Now",clear:"Clear"},Pagination:{goto:"Goto",selectionSuffix:"page"},DynamicTags:{add:"Add"},Log:{loading:"Loading"},Input:{placeholder:"Please Input"},InputNumber:{placeholder:"Please Input"},DynamicInput:{create:"Create"},ThemeEditor:{title:"Theme Editor",clearAllVars:"Clear All Variables",clearSearch:"Clear Search",filterCompName:"Filter Component Name",filterVarName:"Filter Variable Name",import:"Import",export:"Export",restore:"Reset to Default"},Image:{tipPrevious:"Previous picture (←)",tipNext:"Next picture (→)",tipCounterclockwise:"Counterclockwise",tipClockwise:"Clockwise",tipZoomOut:"Zoom out",tipZoomIn:"Zoom in",tipDownload:"Download",tipClose:"Close (Esc)",tipOriginalSize:"Zoom to original size"},Heatmap:{less:"less",more:"more",monthFormat:"MMM",weekdayFormat:"eee"}};function al(n){return(e={})=>{const i=e.width?String(e.width):n.defaultWidth;return n.formats[i]||n.formats[n.defaultWidth]}}function Yr(n){return(e,i)=>{const r=i!=null&&i.context?String(i.context):"standalone";let o;if(r==="formatting"&&n.formattingValues){const a=n.defaultFormattingWidth||n.defaultWidth,l=i!=null&&i.width?String(i.width):a;o=n.formattingValues[l]||n.formattingValues[a]}else{const a=n.defaultWidth,l=i!=null&&i.width?String(i.width):n.defaultWidth;o=n.values[l]||n.values[a]}const s=n.argumentCallback?n.argumentCallback(e):e;return o[s]}}function Ur(n){return(e,i={})=>{const r=i.width,o=r&&n.matchPatterns[r]||n.matchPatterns[n.defaultMatchWidth],s=e.match(o);if(!s)return null;const a=s[0],l=r&&n.parsePatterns[r]||n.parsePatterns[n.defaultParseWidth],c=Array.isArray(l)?WS(l,f=>f.test(a)):HS(l,f=>f.test(a));let d;d=n.valueCallback?n.valueCallback(c):c,d=i.valueCallback?i.valueCallback(d):d;const u=e.slice(a.length);return{value:d,rest:u}}}function HS(n,e){for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&e(n[i]))return i}function WS(n,e){for(let i=0;i<n.length;i++)if(e(n[i]))return i}function jS(n){return(e,i={})=>{const r=e.match(n.matchPattern);if(!r)return null;const o=r[0],s=e.match(n.parsePattern);if(!s)return null;let a=n.valueCallback?n.valueCallback(s[0]):s[0];a=i.valueCallback?i.valueCallback(a):a;const l=e.slice(o.length);return{value:a,rest:l}}}const qS={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},XS=(n,e,i)=>{let r;const o=qS[n];return typeof o=="string"?r=o:e===1?r=o.one:r=o.other.replace("{{count}}",e.toString()),i!=null&&i.addSuffix?i.comparison&&i.comparison>0?"in "+r:r+" ago":r},YS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},US=(n,e,i,r)=>YS[n],KS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},GS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ZS={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},QS={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},JS={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},eB={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},tB={ordinalNumber:(n,e)=>{const i=Number(n),r=i%100;if(r>20||r<10)switch(r%10){case 1:return i+"st";case 2:return i+"nd";case 3:return i+"rd"}return i+"th"},era:Yr({values:KS,defaultWidth:"wide"}),quarter:Yr({values:GS,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Yr({values:ZS,defaultWidth:"wide"}),day:Yr({values:QS,defaultWidth:"wide"}),dayPeriod:Yr({values:JS,defaultWidth:"wide",formattingValues:eB,defaultFormattingWidth:"wide"})},nB=/^(\d+)(th|st|nd|rd)?/i,iB=/\d+/i,rB={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},oB={any:[/^b/i,/^(a|c)/i]},sB={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},aB={any:[/1/i,/2/i,/3/i,/4/i]},lB={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},cB={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},dB={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},uB={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},fB={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},hB={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},mB={ordinalNumber:jS({matchPattern:nB,parsePattern:iB,valueCallback:n=>parseInt(n,10)}),era:Ur({matchPatterns:rB,defaultMatchWidth:"wide",parsePatterns:oB,defaultParseWidth:"any"}),quarter:Ur({matchPatterns:sB,defaultMatchWidth:"wide",parsePatterns:aB,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Ur({matchPatterns:lB,defaultMatchWidth:"wide",parsePatterns:cB,defaultParseWidth:"any"}),day:Ur({matchPatterns:dB,defaultMatchWidth:"wide",parsePatterns:uB,defaultParseWidth:"any"}),dayPeriod:Ur({matchPatterns:fB,defaultMatchWidth:"any",parsePatterns:hB,defaultParseWidth:"any"})},pB={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},gB={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},yB={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},bB={date:al({formats:pB,defaultWidth:"full"}),time:al({formats:gB,defaultWidth:"full"}),dateTime:al({formats:yB,defaultWidth:"full"})},_B={name:"en-US",locale:{code:"en-US",formatDistance:XS,formatLong:bB,formatRelative:US,localize:tB,match:mB,options:{weekStartsOn:0,firstWeekContainsDate:1}}};function zh(n){const{mergedLocaleRef:e,mergedDateLocaleRef:i}=t.inject(Ai,null)||{},r=t.computed(()=>{var s,a;return(a=(s=e==null?void 0:e.value)===null||s===void 0?void 0:s[n])!==null&&a!==void 0?a:LS[n]});return{dateLocaleRef:t.computed(()=>{var s;return(s=i==null?void 0:i.value)!==null&&s!==void 0?s:_B}),localeRef:r}}const Kr="naive-ui-style";function Gr(n,e,i){if(!e)return;const r=Fi(),o=t.computed(()=>{const{value:l}=e;if(!l)return;const c=l[n];if(c)return c}),s=t.inject(Ai,null),a=()=>{t.watchEffect(()=>{const{value:l}=i,c=`${l}${n}Rtl`;if(Wv(c,r))return;const{value:d}=o;d&&d.style.mount({id:c,head:!0,anchorMetaName:Kr,props:{bPrefix:l?`.${l}-`:void 0},ssr:r,parent:s==null?void 0:s.styleMountTarget})})};return r?a():t.onBeforeMount(a),o}const Zr={fontFamily:'v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontFamilyMono:"v-mono, SFMono-Regular, Menlo, Consolas, Courier, monospace",fontWeight:"400",fontWeightStrong:"500",cubicBezierEaseInOut:"cubic-bezier(.4, 0, .2, 1)",cubicBezierEaseOut:"cubic-bezier(0, 0, .2, 1)",cubicBezierEaseIn:"cubic-bezier(.4, 0, 1, 1)",borderRadius:"3px",borderRadiusSmall:"2px",fontSize:"14px",fontSizeMini:"12px",fontSizeTiny:"12px",fontSizeSmall:"14px",fontSizeMedium:"14px",fontSizeLarge:"15px",fontSizeHuge:"16px",lineHeight:"1.6",heightMini:"16px",heightTiny:"22px",heightSmall:"28px",heightMedium:"34px",heightLarge:"40px",heightHuge:"46px"},{fontSize:wB,fontFamily:xB,lineHeight:kB}=Zr,Dh=he("body",`
|
|
116
|
+
`)}function Xa(n){for(var e=0,i,r=0,o=n.length;o>=4;++r,o-=4)i=n.charCodeAt(r)&255|(n.charCodeAt(++r)&255)<<8|(n.charCodeAt(++r)&255)<<16|(n.charCodeAt(++r)&255)<<24,i=(i&65535)*1540483477+((i>>>16)*59797<<16),i^=i>>>24,e=(i&65535)*1540483477+((i>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(o){case 3:e^=(n.charCodeAt(r+2)&255)<<16;case 2:e^=(n.charCodeAt(r+1)&255)<<8;case 1:e^=n.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}typeof window<"u"&&(window.__cssrContext={});function Av(n,e,i,r){const{els:o}=e;if(i===void 0)o.forEach(zf),e.els=[];else{const s=is(i,r);s&&o.includes(s)&&(zf(s),e.els=o.filter(a=>a!==s))}}function Wf(n,e){n.push(e)}function Ov(n,e,i,r,o,s,a,l,c){let d;if(i===void 0&&(d=e.render(r),i=Xa(d)),c){c.adapter(i,d??e.render(r));return}l===void 0&&(l=document.head);const u=is(i,l);if(u!==null&&!s)return u;const f=u??Pv(i);if(d===void 0&&(d=e.render(r)),f.textContent=d,u!==null)return u;if(a){const h=l.querySelector(`meta[name="${a}"]`);if(h)return l.insertBefore(f,h),Wf(e.els,f),f}return o?l.insertBefore(f,l.querySelector("style, link")):l.appendChild(f),Wf(e.els,f),f}function zv(n){return Iv(this,this.instance,n)}function Dv(n={}){const{id:e,ssr:i,props:r,head:o=!1,force:s=!1,anchorMetaName:a,parent:l}=n;return Ov(this.instance,this,e,r,o,s,a,l,i)}function Lv(n={}){const{id:e,parent:i}=n;Av(this.instance,this,e,i)}const os=function(n,e,i,r){return{instance:n,$:e,props:i,children:r,els:[],render:zv,mount:Dv,unmount:Lv}},Hv=function(n,e,i,r){return Array.isArray(e)?os(n,{$:null},null,e):Array.isArray(i)?os(n,e,null,i):Array.isArray(r)?os(n,e,i,r):os(n,e,i,null)};function jf(n={}){const e={c:((...i)=>Hv(e,...i)),use:(i,...r)=>i.install(e,...r),find:is,context:{},config:n};return e}function Wv(n,e){if(n===void 0)return!1;if(e){const{context:{ids:i}}=e;return i.has(n)}return is(n)!==null}const{c:pi}=jf(),Ya="vueuc-style";function qf(n){return n&-n}class Xf{constructor(e,i){this.l=e,this.min=i;const r=new Array(e+1);for(let o=0;o<e+1;++o)r[o]=0;this.ft=r}add(e,i){if(i===0)return;const{l:r,ft:o}=this;for(e+=1;e<=r;)o[e]+=i,e+=qf(e)}get(e){return this.sum(e+1)-this.sum(e)}sum(e){if(e===void 0&&(e=this.l),e<=0)return 0;const{ft:i,min:r,l:o}=this;if(e>o)throw new Error("[FinweckTree.sum]: `i` is larger than length.");let s=e*r;for(;e>0;)s+=i[e],e-=qf(e);return s}getBound(e){let i=0,r=this.l;for(;r>i;){const o=Math.floor((i+r)/2),s=this.sum(o);if(s>e){r=o;continue}else if(s<e){if(i===o)return this.sum(i+1)<=e?i+1:o;i=o}else return o}return i}}function Yf(n){return typeof n=="string"?document.querySelector(n):n()||null}const jv=t.defineComponent({name:"LazyTeleport",props:{to:{type:[String,Object],default:void 0},disabled:Boolean,show:{type:Boolean,required:!0}},setup(n){return{showTeleport:gv(t.toRef(n,"show")),mergedTo:t.computed(()=>{const{to:e}=n;return e??"body"})}},render(){return this.showTeleport?this.disabled?Ha("lazy-teleport",this.$slots):t.h(t.Teleport,{disabled:this.disabled,to:this.mergedTo},Ha("lazy-teleport",this.$slots)):null}}),ss={top:"bottom",bottom:"top",left:"right",right:"left"},Uf={start:"end",center:"center",end:"start"},Ua={top:"height",bottom:"height",left:"width",right:"width"},qv={"bottom-start":"top left",bottom:"top center","bottom-end":"top right","top-start":"bottom left",top:"bottom center","top-end":"bottom right","right-start":"top left",right:"center left","right-end":"bottom left","left-start":"top right",left:"center right","left-end":"bottom right"},Xv={"bottom-start":"bottom left",bottom:"bottom center","bottom-end":"bottom right","top-start":"top left",top:"top center","top-end":"top right","right-start":"top right",right:"center right","right-end":"bottom right","left-start":"top left",left:"center left","left-end":"bottom left"},Yv={"bottom-start":"right","bottom-end":"left","top-start":"right","top-end":"left","right-start":"bottom","right-end":"top","left-start":"bottom","left-end":"top"},Kf={top:!0,bottom:!1,left:!0,right:!1},Gf={top:"end",bottom:"start",left:"end",right:"start"};function Uv(n,e,i,r,o,s){if(!o||s)return{placement:n,top:0,left:0};const[a,l]=n.split("-");let c=l??"center",d={top:0,left:0};const u=(p,m,g)=>{let b=0,y=0;const _=i[p]-e[m]-e[p];return _>0&&r&&(g?y=Kf[m]?_:-_:b=Kf[m]?_:-_),{left:b,top:y}},f=a==="left"||a==="right";if(c!=="center"){const p=Yv[n],m=ss[p],g=Ua[p];if(i[g]>e[g]){if(e[p]+e[g]<i[g]){const b=(i[g]-e[g])/2;e[p]<b||e[m]<b?e[p]<e[m]?(c=Uf[l],d=u(g,m,f)):d=u(g,p,f):c="center"}}else i[g]<e[g]&&e[m]<0&&e[p]>e[m]&&(c=Uf[l])}else{const p=a==="bottom"||a==="top"?"left":"top",m=ss[p],g=Ua[p],b=(i[g]-e[g])/2;(e[p]<b||e[m]<b)&&(e[p]>e[m]?(c=Gf[p],d=u(g,p,f)):(c=Gf[m],d=u(g,m,f)))}let h=a;return e[a]<i[Ua[a]]&&e[a]<e[ss[a]]&&(h=ss[a]),{placement:c!=="center"?`${h}-${c}`:h,left:d.left,top:d.top}}function Kv(n,e){return e?Xv[n]:qv[n]}function Gv(n,e,i,r,o,s){if(s)switch(n){case"bottom-start":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-100%)"};case"bottom-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-100%)"};case"top-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left)}px`,transform:""};case"top-end":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%)"};case"right-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%)"};case"right-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-100%)"};case"left-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left)}px`,transform:""};case"left-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-100%)"};case"top":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width/2)}px`,transform:"translateX(-50%)"};case"right":return{top:`${Math.round(i.top-e.top+i.height/2)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-50%)"};case"left":return{top:`${Math.round(i.top-e.top+i.height/2)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-50%)"};case"bottom":default:return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width/2)}px`,transform:"translateX(-50%) translateY(-100%)"}}switch(n){case"bottom-start":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:""};case"bottom-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateX(-100%)"};case"top-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateY(-100%)"};case"top-end":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateX(-100%) translateY(-100%)"};case"right-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:""};case"right-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateY(-100%)"};case"left-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateX(-100%)"};case"left-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateX(-100%) translateY(-100%)"};case"top":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width/2+o)}px`,transform:"translateY(-100%) translateX(-50%)"};case"right":return{top:`${Math.round(i.top-e.top+i.height/2+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateY(-50%)"};case"left":return{top:`${Math.round(i.top-e.top+i.height/2+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateY(-50%) translateX(-100%)"};case"bottom":default:return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width/2+o)}px`,transform:"translateX(-50%)"}}}const Zv=pi([pi(".v-binder-follower-container",{position:"absolute",left:"0",right:"0",top:"0",height:"0",pointerEvents:"none",zIndex:"auto"}),pi(".v-binder-follower-content",{position:"absolute",zIndex:"auto"},[pi("> *",{pointerEvents:"all"})])]),Zf=t.defineComponent({name:"Follower",inheritAttrs:!1,props:{show:Boolean,enabled:{type:Boolean,default:void 0},placement:{type:String,default:"bottom"},syncTrigger:{type:Array,default:["resize","scroll"]},to:[String,Object],flip:{type:Boolean,default:!0},internalShift:Boolean,x:Number,y:Number,width:String,minWidth:String,containerClass:String,teleportDisabled:Boolean,zindexable:{type:Boolean,default:!0},zIndex:Number,overlap:Boolean},setup(n){const e=t.inject("VBinder"),i=an(()=>n.enabled!==void 0?n.enabled:n.show),r=t.ref(null),o=t.ref(null),s=()=>{const{syncTrigger:h}=n;h.includes("scroll")&&e.addScrollListener(c),h.includes("resize")&&e.addResizeListener(c)},a=()=>{e.removeScrollListener(c),e.removeResizeListener(c)};t.onMounted(()=>{i.value&&(c(),s())});const l=Fi();Zv.mount({id:"vueuc/binder",head:!0,anchorMetaName:Ya,ssr:l}),t.onBeforeUnmount(()=>{a()}),bv(()=>{i.value&&c()});const c=()=>{if(!i.value)return;const h=r.value;if(h===null)return;const p=e.targetRef,{x:m,y:g,overlap:b}=n,y=m!==void 0&&g!==void 0?xv(m,g):ja(p);h.style.setProperty("--v-target-width",`${Math.round(y.width)}px`),h.style.setProperty("--v-target-height",`${Math.round(y.height)}px`);const{width:_,minWidth:k,placement:x,internalShift:v,flip:B}=n;h.setAttribute("v-placement",x),b?h.setAttribute("v-overlap",""):h.removeAttribute("v-overlap");const{style:w}=h;_==="target"?w.width=`${y.width}px`:_!==void 0?w.width=_:w.width="",k==="target"?w.minWidth=`${y.width}px`:k!==void 0?w.minWidth=k:w.minWidth="";const T=ja(h),C=ja(o.value),{left:$,top:E,placement:I}=Uv(x,y,T,v,B,b),R=Kv(I,b),{left:O,top:U,transform:Q}=Gv(I,C,y,E,$,b);h.setAttribute("v-placement",I),h.style.setProperty("--v-offset-left",`${Math.round($)}px`),h.style.setProperty("--v-offset-top",`${Math.round(E)}px`),h.style.transform=`translateX(${O}) translateY(${U}) ${Q}`,h.style.setProperty("--v-transform-origin",R),h.style.transformOrigin=R};t.watch(i,h=>{h?(s(),d()):a()});const d=()=>{t.nextTick().then(c).catch(h=>console.error(h))};["placement","x","y","internalShift","flip","width","overlap","minWidth"].forEach(h=>{t.watch(t.toRef(n,h),c)}),["teleportDisabled"].forEach(h=>{t.watch(t.toRef(n,h),d)}),t.watch(t.toRef(n,"syncTrigger"),h=>{h.includes("resize")?e.addResizeListener(c):e.removeResizeListener(c),h.includes("scroll")?e.addScrollListener(c):e.removeScrollListener(c)});const u=ns(),f=an(()=>{const{to:h}=n;if(h!==void 0)return h;u.value});return{VBinder:e,mergedEnabled:i,offsetContainerRef:o,followerRef:r,mergedTo:f,syncPosition:c}},render(){return t.h(jv,{show:this.show,to:this.mergedTo,disabled:this.teleportDisabled},{default:()=>{var n,e;const i=t.h("div",{class:["v-binder-follower-container",this.containerClass],ref:"offsetContainerRef"},[t.h("div",{class:"v-binder-follower-content",ref:"followerRef"},(e=(n=this.$slots).default)===null||e===void 0?void 0:e.call(n))]);return this.zindexable?t.withDirectives(i,[[Ef,{enabled:this.mergedEnabled,zIndex:this.zIndex}]]):i}})}});var Vi=[],Qv=function(){return Vi.some(function(n){return n.activeTargets.length>0})},Jv=function(){return Vi.some(function(n){return n.skippedTargets.length>0})},Qf="ResizeObserver loop completed with undelivered notifications.",eS=function(){var n;typeof ErrorEvent=="function"?n=new ErrorEvent("error",{message:Qf}):(n=document.createEvent("Event"),n.initEvent("error",!1,!1),n.message=Qf),window.dispatchEvent(n)},Wr;(function(n){n.BORDER_BOX="border-box",n.CONTENT_BOX="content-box",n.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Wr||(Wr={}));var Mi=function(n){return Object.freeze(n)},tS=(function(){function n(e,i){this.inlineSize=e,this.blockSize=i,Mi(this)}return n})(),Jf=(function(){function n(e,i,r,o){return this.x=e,this.y=i,this.width=r,this.height=o,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Mi(this)}return n.prototype.toJSON=function(){var e=this,i=e.x,r=e.y,o=e.top,s=e.right,a=e.bottom,l=e.left,c=e.width,d=e.height;return{x:i,y:r,top:o,right:s,bottom:a,left:l,width:c,height:d}},n.fromRect=function(e){return new n(e.x,e.y,e.width,e.height)},n})(),Ka=function(n){return n instanceof SVGElement&&"getBBox"in n},eh=function(n){if(Ka(n)){var e=n.getBBox(),i=e.width,r=e.height;return!i&&!r}var o=n,s=o.offsetWidth,a=o.offsetHeight;return!(s||a||n.getClientRects().length)},th=function(n){var e;if(n instanceof Element)return!0;var i=(e=n==null?void 0:n.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(i&&n instanceof i.Element)},nS=function(n){switch(n.tagName){case"INPUT":if(n.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},jr=typeof window<"u"?window:{},as=new WeakMap,nh=/auto|scroll/,iS=/^tb|vertical/,rS=/msie|trident/i.test(jr.navigator&&jr.navigator.userAgent),Vn=function(n){return parseFloat(n||"0")},gr=function(n,e,i){return n===void 0&&(n=0),e===void 0&&(e=0),i===void 0&&(i=!1),new tS((i?e:n)||0,(i?n:e)||0)},ih=Mi({devicePixelContentBoxSize:gr(),borderBoxSize:gr(),contentBoxSize:gr(),contentRect:new Jf(0,0,0,0)}),rh=function(n,e){if(e===void 0&&(e=!1),as.has(n)&&!e)return as.get(n);if(eh(n))return as.set(n,ih),ih;var i=getComputedStyle(n),r=Ka(n)&&n.ownerSVGElement&&n.getBBox(),o=!rS&&i.boxSizing==="border-box",s=iS.test(i.writingMode||""),a=!r&&nh.test(i.overflowY||""),l=!r&&nh.test(i.overflowX||""),c=r?0:Vn(i.paddingTop),d=r?0:Vn(i.paddingRight),u=r?0:Vn(i.paddingBottom),f=r?0:Vn(i.paddingLeft),h=r?0:Vn(i.borderTopWidth),p=r?0:Vn(i.borderRightWidth),m=r?0:Vn(i.borderBottomWidth),g=r?0:Vn(i.borderLeftWidth),b=f+d,y=c+u,_=g+p,k=h+m,x=l?n.offsetHeight-k-n.clientHeight:0,v=a?n.offsetWidth-_-n.clientWidth:0,B=o?b+_:0,w=o?y+k:0,T=r?r.width:Vn(i.width)-B-v,C=r?r.height:Vn(i.height)-w-x,$=T+b+v+_,E=C+y+x+k,I=Mi({devicePixelContentBoxSize:gr(Math.round(T*devicePixelRatio),Math.round(C*devicePixelRatio),s),borderBoxSize:gr($,E,s),contentBoxSize:gr(T,C,s),contentRect:new Jf(f,c,T,C)});return as.set(n,I),I},oh=function(n,e,i){var r=rh(n,i),o=r.borderBoxSize,s=r.contentBoxSize,a=r.devicePixelContentBoxSize;switch(e){case Wr.DEVICE_PIXEL_CONTENT_BOX:return a;case Wr.BORDER_BOX:return o;default:return s}},oS=(function(){function n(e){var i=rh(e);this.target=e,this.contentRect=i.contentRect,this.borderBoxSize=Mi([i.borderBoxSize]),this.contentBoxSize=Mi([i.contentBoxSize]),this.devicePixelContentBoxSize=Mi([i.devicePixelContentBoxSize])}return n})(),sh=function(n){if(eh(n))return 1/0;for(var e=0,i=n.parentNode;i;)e+=1,i=i.parentNode;return e},sS=function(){var n=1/0,e=[];Vi.forEach(function(a){if(a.activeTargets.length!==0){var l=[];a.activeTargets.forEach(function(d){var u=new oS(d.target),f=sh(d.target);l.push(u),d.lastReportedSize=oh(d.target,d.observedBox),f<n&&(n=f)}),e.push(function(){a.callback.call(a.observer,l,a.observer)}),a.activeTargets.splice(0,a.activeTargets.length)}});for(var i=0,r=e;i<r.length;i++){var o=r[i];o()}return n},ah=function(n){Vi.forEach(function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach(function(o){o.isActive()&&(sh(o.target)>n?i.activeTargets.push(o):i.skippedTargets.push(o))})})},aS=function(){var n=0;for(ah(n);Qv();)n=sS(),ah(n);return Jv()&&eS(),n>0},Ga,lh=[],lS=function(){return lh.splice(0).forEach(function(n){return n()})},cS=function(n){if(!Ga){var e=0,i=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return lS()}).observe(i,r),Ga=function(){i.textContent="".concat(e?e--:e++)}}lh.push(n),Ga()},dS=function(n){cS(function(){requestAnimationFrame(n)})},ls=0,uS=function(){return!!ls},fS=250,hS={attributes:!0,characterData:!0,childList:!0,subtree:!0},ch=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],dh=function(n){return n===void 0&&(n=0),Date.now()+n},Za=!1,mS=(function(){function n(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return n.prototype.run=function(e){var i=this;if(e===void 0&&(e=fS),!Za){Za=!0;var r=dh(e);dS(function(){var o=!1;try{o=aS()}finally{if(Za=!1,e=r-dh(),!uS())return;o?i.run(1e3):e>0?i.run(e):i.start()}})}},n.prototype.schedule=function(){this.stop(),this.run()},n.prototype.observe=function(){var e=this,i=function(){return e.observer&&e.observer.observe(document.body,hS)};document.body?i():jr.addEventListener("DOMContentLoaded",i)},n.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),ch.forEach(function(i){return jr.addEventListener(i,e.listener,!0)}))},n.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),ch.forEach(function(i){return jr.removeEventListener(i,e.listener,!0)}),this.stopped=!0)},n})(),Qa=new mS,uh=function(n){!ls&&n>0&&Qa.start(),ls+=n,!ls&&Qa.stop()},pS=function(n){return!Ka(n)&&!nS(n)&&getComputedStyle(n).display==="inline"},gS=(function(){function n(e,i){this.target=e,this.observedBox=i||Wr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return n.prototype.isActive=function(){var e=oh(this.target,this.observedBox,!0);return pS(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},n})(),yS=(function(){function n(e,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=i}return n})(),cs=new WeakMap,fh=function(n,e){for(var i=0;i<n.length;i+=1)if(n[i].target===e)return i;return-1},ds=(function(){function n(){}return n.connect=function(e,i){var r=new yS(e,i);cs.set(e,r)},n.observe=function(e,i,r){var o=cs.get(e),s=o.observationTargets.length===0;fh(o.observationTargets,i)<0&&(s&&Vi.push(o),o.observationTargets.push(new gS(i,r&&r.box)),uh(1),Qa.schedule())},n.unobserve=function(e,i){var r=cs.get(e),o=fh(r.observationTargets,i),s=r.observationTargets.length===1;o>=0&&(s&&Vi.splice(Vi.indexOf(r),1),r.observationTargets.splice(o,1),uh(-1))},n.disconnect=function(e){var i=this,r=cs.get(e);r.observationTargets.slice().forEach(function(o){return i.unobserve(e,o.target)}),r.activeTargets.splice(0,r.activeTargets.length)},n})(),bS=(function(){function n(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");ds.connect(this,e)}return n.prototype.observe=function(e,i){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!th(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ds.observe(this,e,i)},n.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!th(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ds.unobserve(this,e)},n.prototype.disconnect=function(){ds.disconnect(this)},n.toString=function(){return"function ResizeObserver () { [polyfill code] }"},n})();class _S{constructor(){this.handleResize=this.handleResize.bind(this),this.observer=new(typeof window<"u"&&window.ResizeObserver||bS)(this.handleResize),this.elHandlersMap=new Map}handleResize(e){for(const i of e){const r=this.elHandlersMap.get(i.target);r!==void 0&&r(i)}}registerHandler(e,i){this.elHandlersMap.set(e,i),this.observer.observe(e)}unregisterHandler(e){this.elHandlersMap.has(e)&&(this.elHandlersMap.delete(e),this.observer.unobserve(e))}}const qr=new _S,us=t.defineComponent({name:"ResizeObserver",props:{onResize:Function},setup(n){let e=!1;const i=t.getCurrentInstance().proxy;function r(o){const{onResize:s}=n;s!==void 0&&s(o)}t.onMounted(()=>{const o=i.$el;if(o===void 0){Af("resize-observer","$el does not exist.");return}if(o.nextElementSibling!==o.nextSibling&&o.nodeType===3&&o.nodeValue!==""){Af("resize-observer","$el can not be observed (it may be a text node).");return}o.nextElementSibling!==null&&(qr.registerHandler(o.nextElementSibling,r),e=!0)}),t.onBeforeUnmount(()=>{e&&qr.unregisterHandler(i.$el.nextElementSibling)})},render(){return t.renderSlot(this.$slots,"default")}});let fs;function wS(){return typeof document>"u"?!1:(fs===void 0&&("matchMedia"in window?fs=window.matchMedia("(pointer:coarse)").matches:fs=!1),fs)}let Ja;function hh(){return typeof document>"u"?1:(Ja===void 0&&(Ja="chrome"in window?window.devicePixelRatio:1),Ja)}const mh="VVirtualListXScroll";function xS({columnsRef:n,renderColRef:e,renderItemWithColsRef:i}){const r=t.ref(0),o=t.ref(0),s=t.computed(()=>{const d=n.value;if(d.length===0)return null;const u=new Xf(d.length,0);return d.forEach((f,h)=>{u.add(h,f.width)}),u}),a=an(()=>{const d=s.value;return d!==null?Math.max(d.getBound(o.value)-1,0):0}),l=d=>{const u=s.value;return u!==null?u.sum(d):0},c=an(()=>{const d=s.value;return d!==null?Math.min(d.getBound(o.value+r.value)+1,n.value.length-1):0});return t.provide(mh,{startIndexRef:a,endIndexRef:c,columnsRef:n,renderColRef:e,renderItemWithColsRef:i,getLeft:l}),{listWidthRef:r,scrollLeftRef:o}}const ph=t.defineComponent({name:"VirtualListRow",props:{index:{type:Number,required:!0},item:{type:Object,required:!0}},setup(){const{startIndexRef:n,endIndexRef:e,columnsRef:i,getLeft:r,renderColRef:o,renderItemWithColsRef:s}=t.inject(mh);return{startIndex:n,endIndex:e,columns:i,renderCol:o,renderItemWithCols:s,getLeft:r}},render(){const{startIndex:n,endIndex:e,columns:i,renderCol:r,renderItemWithCols:o,getLeft:s,item:a}=this;if(o!=null)return o({itemIndex:this.index,startColIndex:n,endColIndex:e,allColumns:i,item:a,getLeft:s});if(r!=null){const l=[];for(let c=n;c<=e;++c){const d=i[c];l.push(r({column:d,left:s(c),item:a}))}return l}return null}}),kS=pi(".v-vl",{maxHeight:"inherit",height:"100%",overflow:"auto",minWidth:"1px"},[pi("&:not(.v-vl--show-scrollbar)",{scrollbarWidth:"none"},[pi("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb",{width:0,height:0,display:"none"})])]),CS=t.defineComponent({name:"VirtualList",inheritAttrs:!1,props:{showScrollbar:{type:Boolean,default:!0},columns:{type:Array,default:()=>[]},renderCol:Function,renderItemWithCols:Function,items:{type:Array,default:()=>[]},itemSize:{type:Number,required:!0},itemResizable:Boolean,itemsStyle:[String,Object],visibleItemsTag:{type:[String,Object],default:"div"},visibleItemsProps:Object,ignoreItemResize:Boolean,onScroll:Function,onWheel:Function,onResize:Function,defaultScrollKey:[Number,String],defaultScrollIndex:Number,keyField:{type:String,default:"key"},paddingTop:{type:[Number,String],default:0},paddingBottom:{type:[Number,String],default:0}},setup(n){const e=Fi();kS.mount({id:"vueuc/virtual-list",head:!0,anchorMetaName:Ya,ssr:e}),t.onMounted(()=>{const{defaultScrollIndex:R,defaultScrollKey:O}=n;R!=null?b({index:R}):O!=null&&b({key:O})});let i=!1,r=!1;t.onActivated(()=>{if(i=!1,!r){r=!0;return}b({top:p.value,left:a.value})}),t.onDeactivated(()=>{i=!0,r||(r=!0)});const o=an(()=>{if(n.renderCol==null&&n.renderItemWithCols==null||n.columns.length===0)return;let R=0;return n.columns.forEach(O=>{R+=O.width}),R}),s=t.computed(()=>{const R=new Map,{keyField:O}=n;return n.items.forEach((U,Q)=>{R.set(U[O],Q)}),R}),{scrollLeftRef:a,listWidthRef:l}=xS({columnsRef:t.toRef(n,"columns"),renderColRef:t.toRef(n,"renderCol"),renderItemWithColsRef:t.toRef(n,"renderItemWithCols")}),c=t.ref(null),d=t.ref(void 0),u=new Map,f=t.computed(()=>{const{items:R,itemSize:O,keyField:U}=n,Q=new Xf(R.length,O);return R.forEach((G,W)=>{const D=G[U],L=u.get(D);L!==void 0&&Q.add(W,L)}),Q}),h=t.ref(0),p=t.ref(0),m=an(()=>Math.max(f.value.getBound(p.value-Dr(n.paddingTop))-1,0)),g=t.computed(()=>{const{value:R}=d;if(R===void 0)return[];const{items:O,itemSize:U}=n,Q=m.value,G=Math.min(Q+Math.ceil(R/U+1),O.length-1),W=[];for(let D=Q;D<=G;++D)W.push(O[D]);return W}),b=(R,O)=>{if(typeof R=="number"){x(R,O,"auto");return}const{left:U,top:Q,index:G,key:W,position:D,behavior:L,debounce:z=!0}=R;if(U!==void 0||Q!==void 0)x(U,Q,L);else if(G!==void 0)k(G,L,z);else if(W!==void 0){const P=s.value.get(W);P!==void 0&&k(P,L,z)}else D==="bottom"?x(0,Number.MAX_SAFE_INTEGER,L):D==="top"&&x(0,0,L)};let y,_=null;function k(R,O,U){const{value:Q}=f,G=Q.sum(R)+Dr(n.paddingTop);if(!U)c.value.scrollTo({left:0,top:G,behavior:O});else{y=R,_!==null&&window.clearTimeout(_),_=window.setTimeout(()=>{y=void 0,_=null},16);const{scrollTop:W,offsetHeight:D}=c.value;if(G>W){const L=Q.get(R);G+L<=W+D||c.value.scrollTo({left:0,top:G+L-D,behavior:O})}else c.value.scrollTo({left:0,top:G,behavior:O})}}function x(R,O,U){c.value.scrollTo({left:R,top:O,behavior:U})}function v(R,O){var U,Q,G;if(i||n.ignoreItemResize||I(O.target))return;const{value:W}=f,D=s.value.get(R),L=W.get(D),z=(G=(Q=(U=O.borderBoxSize)===null||U===void 0?void 0:U[0])===null||Q===void 0?void 0:Q.blockSize)!==null&&G!==void 0?G:O.contentRect.height;if(z===L)return;z-n.itemSize===0?u.delete(R):u.set(R,z-n.itemSize);const q=z-L;if(q===0)return;W.add(D,q);const K=c.value;if(K!=null){if(y===void 0){const J=W.sum(D);K.scrollTop>J&&K.scrollBy(0,q)}else if(D<y)K.scrollBy(0,q);else if(D===y){const J=W.sum(D);z+J>K.scrollTop+K.offsetHeight&&K.scrollBy(0,q)}E()}h.value++}const B=!wS();let w=!1;function T(R){var O;(O=n.onScroll)===null||O===void 0||O.call(n,R),(!B||!w)&&E()}function C(R){var O;if((O=n.onWheel)===null||O===void 0||O.call(n,R),B){const U=c.value;if(U!=null){if(R.deltaX===0&&(U.scrollTop===0&&R.deltaY<=0||U.scrollTop+U.offsetHeight>=U.scrollHeight&&R.deltaY>=0))return;R.preventDefault(),U.scrollTop+=R.deltaY/hh(),U.scrollLeft+=R.deltaX/hh(),E(),w=!0,_f(()=>{w=!1})}}}function $(R){if(i||I(R.target))return;if(n.renderCol==null&&n.renderItemWithCols==null){if(R.contentRect.height===d.value)return}else if(R.contentRect.height===d.value&&R.contentRect.width===l.value)return;d.value=R.contentRect.height,l.value=R.contentRect.width;const{onResize:O}=n;O!==void 0&&O(R)}function E(){const{value:R}=c;R!=null&&(p.value=R.scrollTop,a.value=R.scrollLeft)}function I(R){let O=R;for(;O!==null;){if(O.style.display==="none")return!0;O=O.parentElement}return!1}return{listHeight:d,listStyle:{overflow:"auto"},keyToIndex:s,itemsStyle:t.computed(()=>{const{itemResizable:R}=n,O=Lr(f.value.sum());return h.value,[n.itemsStyle,{boxSizing:"content-box",width:Lr(o.value),height:R?"":O,minHeight:R?O:"",paddingTop:Lr(n.paddingTop),paddingBottom:Lr(n.paddingBottom)}]}),visibleItemsStyle:t.computed(()=>(h.value,{transform:`translateY(${Lr(f.value.sum(m.value))})`})),viewportItems:g,listElRef:c,itemsElRef:t.ref(null),scrollTo:b,handleListResize:$,handleListScroll:T,handleListWheel:C,handleItemResize:v}},render(){const{itemResizable:n,keyField:e,keyToIndex:i,visibleItemsTag:r}=this;return t.h(us,{onResize:this.handleListResize},{default:()=>{var o,s;return t.h("div",t.mergeProps(this.$attrs,{class:["v-vl",this.showScrollbar&&"v-vl--show-scrollbar"],onScroll:this.handleListScroll,onWheel:this.handleListWheel,ref:"listElRef"}),[this.items.length!==0?t.h("div",{ref:"itemsElRef",class:"v-vl-items",style:this.itemsStyle},[t.h(r,Object.assign({class:"v-vl-visible-items",style:this.visibleItemsStyle},this.visibleItemsProps),{default:()=>{const{renderCol:a,renderItemWithCols:l}=this;return this.viewportItems.map(c=>{const d=c[e],u=i.get(d),f=a!=null?t.h(ph,{index:u,item:c}):void 0,h=l!=null?t.h(ph,{index:u,item:c}):void 0,p=this.$slots.default({item:c,renderedCols:f,renderedItemWithCols:h,index:u})[0];return n?t.h(us,{key:d,onResize:m=>this.handleItemResize(d,m)},{default:()=>p}):(p.key=d,p)})}})]):(s=(o=this.$slots).empty)===null||s===void 0?void 0:s.call(o)])}})}}),Xn="v-hidden",vS=pi("[v-hidden]",{display:"none!important"}),gh=t.defineComponent({name:"Overflow",props:{getCounter:Function,getTail:Function,updateCounter:Function,onUpdateCount:Function,onUpdateOverflow:Function},setup(n,{slots:e}){const i=t.ref(null),r=t.ref(null);function o(a){const{value:l}=i,{getCounter:c,getTail:d}=n;let u;if(c!==void 0?u=c():u=r.value,!l||!u)return;u.hasAttribute(Xn)&&u.removeAttribute(Xn);const{children:f}=l;if(a.showAllItemsBeforeCalculate)for(const k of f)k.hasAttribute(Xn)&&k.removeAttribute(Xn);const h=l.offsetWidth,p=[],m=e.tail?d==null?void 0:d():null;let g=m?m.offsetWidth:0,b=!1;const y=l.children.length-(e.tail?1:0);for(let k=0;k<y-1;++k){if(k<0)continue;const x=f[k];if(b){x.hasAttribute(Xn)||x.setAttribute(Xn,"");continue}else x.hasAttribute(Xn)&&x.removeAttribute(Xn);const v=x.offsetWidth;if(g+=v,p[k]=v,g>h){const{updateCounter:B}=n;for(let w=k;w>=0;--w){const T=y-1-w;B!==void 0?B(T):u.textContent=`${T}`;const C=u.offsetWidth;if(g-=p[w],g+C<=h||w===0){b=!0,k=w-1,m&&(k===-1?(m.style.maxWidth=`${h-C}px`,m.style.boxSizing="border-box"):m.style.maxWidth="");const{onUpdateCount:$}=n;$&&$(T);break}}}}const{onUpdateOverflow:_}=n;b?_!==void 0&&_(!0):(_!==void 0&&_(!1),u.setAttribute(Xn,""))}const s=Fi();return vS.mount({id:"vueuc/overflow",head:!0,anchorMetaName:Ya,ssr:s}),t.onMounted(()=>o({showAllItemsBeforeCalculate:!1})),{selfRef:i,counterRef:r,sync:o}},render(){const{$slots:n}=this;return t.nextTick(()=>this.sync({showAllItemsBeforeCalculate:!1})),t.h("div",{class:"v-overflow",ref:"selfRef"},[t.renderSlot(n,"default"),n.counter?n.counter():t.h("span",{style:{display:"inline-block"},ref:"counterRef"}),n.tail?n.tail():null])}});function yh(n){return n instanceof HTMLElement}function bh(n){for(let e=0;e<n.childNodes.length;e++){const i=n.childNodes[e];if(yh(i)&&(wh(i)||bh(i)))return!0}return!1}function _h(n){for(let e=n.childNodes.length-1;e>=0;e--){const i=n.childNodes[e];if(yh(i)&&(wh(i)||_h(i)))return!0}return!1}function wh(n){if(!SS(n))return!1;try{n.focus({preventScroll:!0})}catch{}return document.activeElement===n}function SS(n){if(n.tabIndex>0||n.tabIndex===0&&n.getAttribute("tabIndex")!==null)return!0;if(n.getAttribute("disabled"))return!1;switch(n.nodeName){case"A":return!!n.href&&n.rel!=="ignore";case"INPUT":return n.type!=="hidden"&&n.type!=="file";case"SELECT":case"TEXTAREA":return!0;default:return!1}}let Xr=[];const BS=t.defineComponent({name:"FocusTrap",props:{disabled:Boolean,active:Boolean,autoFocus:{type:Boolean,default:!0},onEsc:Function,initialFocusTo:[String,Function],finalFocusTo:[String,Function],returnFocusOnDeactivated:{type:Boolean,default:!0}},setup(n){const e=VC(),i=t.ref(null),r=t.ref(null);let o=!1,s=!1;const a=typeof document>"u"?null:document.activeElement;function l(){return Xr[Xr.length-1]===e}function c(b){var y;b.code==="Escape"&&l()&&((y=n.onEsc)===null||y===void 0||y.call(n,b))}t.onMounted(()=>{t.watch(()=>n.active,b=>{b?(f(),At("keydown",document,c)):(ht("keydown",document,c),o&&h())},{immediate:!0})}),t.onBeforeUnmount(()=>{ht("keydown",document,c),o&&h()});function d(b){if(!s&&l()){const y=u();if(y===null||y.contains(zr(b)))return;p("first")}}function u(){const b=i.value;if(b===null)return null;let y=b;for(;y=y.nextSibling,!(y===null||y instanceof Element&&y.tagName==="DIV"););return y}function f(){var b;if(!n.disabled){if(Xr.push(e),n.autoFocus){const{initialFocusTo:y}=n;y===void 0?p("first"):(b=Yf(y))===null||b===void 0||b.focus({preventScroll:!0})}o=!0,document.addEventListener("focus",d,!0)}}function h(){var b;if(n.disabled||(document.removeEventListener("focus",d,!0),Xr=Xr.filter(_=>_!==e),l()))return;const{finalFocusTo:y}=n;y!==void 0?(b=Yf(y))===null||b===void 0||b.focus({preventScroll:!0}):n.returnFocusOnDeactivated&&a instanceof HTMLElement&&(s=!0,a.focus({preventScroll:!0}),s=!1)}function p(b){if(l()&&n.active){const y=i.value,_=r.value;if(y!==null&&_!==null){const k=u();if(k==null||k===_){s=!0,y.focus({preventScroll:!0}),s=!1;return}s=!0;const x=b==="first"?bh(k):_h(k);s=!1,x||(s=!0,y.focus({preventScroll:!0}),s=!1)}}}function m(b){if(s)return;const y=u();y!==null&&(b.relatedTarget!==null&&y.contains(b.relatedTarget)?p("last"):p("first"))}function g(b){s||(b.relatedTarget!==null&&b.relatedTarget===i.value?p("last"):p("first"))}return{focusableStartRef:i,focusableEndRef:r,focusableStyle:"position: absolute; height: 0; width: 0;",handleStartFocus:m,handleEndFocus:g}},render(){const{default:n}=this.$slots;if(n===void 0)return null;if(this.disabled)return n();const{active:e,focusableStyle:i}=this;return t.h(t.Fragment,null,[t.h("div",{"aria-hidden":"true",tabindex:e?"0":"-1",ref:"focusableStartRef",style:i,onFocus:this.handleStartFocus}),n(),t.h("div",{"aria-hidden":"true",style:i,ref:"focusableEndRef",tabindex:e?"0":"-1",onFocus:this.handleEndFocus})])}});function PT(n){return n}const el="n-internal-select-menu",xh="n-internal-select-menu-body",kh="n-drawer-body",Ch="n-modal-body",vh="n-popover-body",Sh="__disabled__";function Yn(n){const e=t.inject(Ch,null),i=t.inject(kh,null),r=t.inject(vh,null),o=t.inject(xh,null),s=t.ref();if(typeof document<"u"){s.value=document.fullscreenElement;const a=()=>{s.value=document.fullscreenElement};t.onMounted(()=>{At("fullscreenchange",document,a)}),t.onBeforeUnmount(()=>{ht("fullscreenchange",document,a)})}return an(()=>{var a;const{to:l}=n;return l!==void 0?l===!1?Sh:l===!0?s.value||"body":l:e!=null&&e.value?(a=e.value.$el)!==null&&a!==void 0?a:e.value:i!=null&&i.value?i.value:r!=null&&r.value?r.value:o!=null&&o.value?o.value:l??(s.value||"body")})}Yn.tdkey=Sh,Yn.propTo={type:[String,Object,Boolean],default:void 0};function NS(n){const e={isDeactivated:!1};let i=!1;return t.onActivated(()=>{if(e.isDeactivated=!1,!i){i=!0;return}n()}),t.onDeactivated(()=>{e.isDeactivated=!0,i||(i=!0)}),e}function Bh(n,e){e&&(t.onMounted(()=>{const{value:i}=n;i&&qr.registerHandler(i,e)}),t.watch(n,(i,r)=>{r&&qr.unregisterHandler(r)},{deep:!1}),t.onBeforeUnmount(()=>{const{value:i}=n;i&&qr.unregisterHandler(i)}))}function Nh(n){return n.replace(/#|\(|\)|,|\s|\./g,"_")}const TS=/^(\d|\.)+$/,Th=/(\d|\.)+/;function tl(n,{c:e=1,offset:i=0,attachPx:r=!0}={}){if(typeof n=="number"){const o=(n+i)*e;return o===0?"0":`${o}px`}else if(typeof n=="string")if(TS.test(n)){const o=(Number(n)+i)*e;return r?o===0?"0":`${o}px`:`${o}`}else{const o=Th.exec(n);return o?n.replace(Th,String((Number(o[0])+i)*e)):n}return n}function $h(n){const{left:e,right:i,top:r,bottom:o}=yn(n);return`${r} ${e} ${o} ${i}`}var Eh={};function $S(n){let e=".",i="__",r="--",o;if(n){let m=n.blockPrefix;m&&(e=m),m=n.elementPrefix,m&&(i=m),m=n.modifierPrefix,m&&(r=m)}const s={install(m){o=m.c;const g=m.context;g.bem={},g.bem.b=null,g.bem.els=null}};function a(m){let g,b;return{before(y){g=y.bem.b,b=y.bem.els,y.bem.els=null},after(y){y.bem.b=g,y.bem.els=b},$({context:y,props:_}){return m=typeof m=="string"?m:m({context:y,props:_}),y.bem.b=m,`${(_==null?void 0:_.bPrefix)||e}${y.bem.b}`}}}function l(m){let g;return{before(b){g=b.bem.els},after(b){b.bem.els=g},$({context:b,props:y}){return m=typeof m=="string"?m:m({context:b,props:y}),b.bem.els=m.split(",").map(_=>_.trim()),b.bem.els.map(_=>`${(y==null?void 0:y.bPrefix)||e}${b.bem.b}${i}${_}`).join(", ")}}}function c(m){return{$({context:g,props:b}){m=typeof m=="string"?m:m({context:g,props:b});const y=m.split(",").map(x=>x.trim());function _(x){return y.map(v=>`&${(b==null?void 0:b.bPrefix)||e}${g.bem.b}${x!==void 0?`${i}${x}`:""}${r}${v}`).join(", ")}const k=g.bem.els;if(k!==null){if(Eh.NODE_ENV!=="production"&&k.length>=2)throw Error(`[css-render/plugin-bem]: m(${m}) is invalid, using modifier inside multiple elements is not allowed`);return _(k[0])}else return _()}}}function d(m){return{$({context:g,props:b}){m=typeof m=="string"?m:m({context:g,props:b});const y=g.bem.els;if(Eh.NODE_ENV!=="production"&&y!==null&&y.length>=2)throw Error(`[css-render/plugin-bem]: notM(${m}) is invalid, using modifier inside multiple elements is not allowed`);return`&:not(${(b==null?void 0:b.bPrefix)||e}${g.bem.b}${y!==null&&y.length>0?`${i}${y[0]}`:""}${r}${m})`}}}return Object.assign(s,{cB:((...m)=>o(a(m[0]),m[1],m[2])),cE:((...m)=>o(l(m[0]),m[1],m[2])),cM:((...m)=>o(c(m[0]),m[1],m[2])),cNotM:((...m)=>o(d(m[0]),m[1],m[2]))}),s}const ES=".n-",RS="__",PS="--",Rh=jf(),Ph=$S({blockPrefix:ES,elementPrefix:RS,modifierPrefix:PS});Rh.use(Ph);const{c:he,find:VT}=Rh,{cB:_e,cE:ve,cM:Fe,cNotM:bn}=Ph,FS=(...n)=>he(">",[_e(...n)]);function nt(n,e){return n+(e==="default"?"":e.replace(/^[a-z]/,i=>i.toUpperCase()))}let nl;function VS(){return nl===void 0&&(nl=navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),nl}const MS=new WeakSet;function IS(n){MS.add(n)}function Fh(n){switch(typeof n){case"string":return n||void 0;case"number":return String(n);default:return}}const Vh=new Set;function gi(n,e){const i=`[naive/${n}]: ${e}`;Vh.has(i)||(Vh.add(i),console.error(i))}function Mh(n,e){console.error(`[naive/${n}]: ${e}`)}function Ih(n,e){throw new Error(`[naive/${n}]: ${e}`)}function Nt(n,...e){if(Array.isArray(n))n.forEach(i=>Nt(i,...e));else return n(...e)}function il(n,e=!0,i=[]){return n.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&i.push(t.createTextVNode(String(r)));return}if(Array.isArray(r)){il(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&il(r.children,e,i)}else{if(r.type===t.Comment&&e)return;i.push(r)}}}),i}function AS(n,e="default",i=void 0){const r=n[e];if(!r)return Mh("getFirstSlotVNode",`slot[${e}] is empty`),null;const o=il(r(i));return o.length===1?o[0]:(Mh("getFirstSlotVNode",`slot[${e}] should have exactly one child`),null)}function OS(n,e=[],i){const r={};return e.forEach(o=>{r[o]=n[o]}),Object.assign(r,i)}function rl(n){const e=n.filter(i=>i!==void 0);if(e.length!==0)return e.length===1?e[0]:i=>{n.forEach(r=>{r&&r(i)})}}function yr(n,...e){return typeof n=="function"?n(...e):typeof n=="string"?t.createTextVNode(n):typeof n=="number"?t.createTextVNode(String(n)):null}function hs(n){return n.some(e=>t.isVNode(e)?!(e.type===t.Comment||e.type===t.Fragment&&!hs(e.children)):!0)?n:null}function ol(n,e){return n&&hs(n())||e()}function Ii(n,e){const i=n&&hs(n());return e(i||null)}function Ah(n){return!(n&&hs(n()))}const sl=t.defineComponent({render(){var n,e;return(e=(n=this.$slots).default)===null||e===void 0?void 0:e.call(n)}}),Ai="n-config-provider",zS="n";function Oi(n={},e={defaultBordered:!0}){const i=t.inject(Ai,null);return{inlineThemeDisabled:i==null?void 0:i.inlineThemeDisabled,mergedRtlRef:i==null?void 0:i.mergedRtlRef,mergedComponentPropsRef:i==null?void 0:i.mergedComponentPropsRef,mergedBreakpointsRef:i==null?void 0:i.mergedBreakpointsRef,mergedBorderedRef:t.computed(()=>{var r,o;const{bordered:s}=n;return s!==void 0?s:(o=(r=i==null?void 0:i.mergedBorderedRef.value)!==null&&r!==void 0?r:e.defaultBordered)!==null&&o!==void 0?o:!0}),mergedClsPrefixRef:i?i.mergedClsPrefixRef:t.shallowRef(zS),namespaceRef:t.computed(()=>i==null?void 0:i.mergedNamespaceRef.value)}}function zi(n,e,i,r){i||Ih("useThemeClass","cssVarsRef is not passed");const o=t.inject(Ai,null),s=o==null?void 0:o.mergedThemeHashRef,a=o==null?void 0:o.styleMountTarget,l=t.ref(""),c=Fi();let d;const u=`__${n}`,f=()=>{let h=u;const p=e?e.value:void 0,m=s==null?void 0:s.value;m&&(h+=`-${m}`),p&&(h+=`-${p}`);const{themeOverrides:g,builtinThemeOverrides:b}=r;g&&(h+=`-${Xa(JSON.stringify(g))}`),b&&(h+=`-${Xa(JSON.stringify(b))}`),l.value=h,d=()=>{const y=i.value;let _="";for(const k in y)_+=`${k}: ${y[k]};`;he(`.${h}`,_).mount({id:h,ssr:c,parent:a}),d=void 0}};return t.watchEffect(()=>{f()}),{themeClass:l,onRender:()=>{d==null||d()}}}const Oh="n-form-item";function DS(n,{defaultSize:e="medium",mergedSize:i,mergedDisabled:r}={}){const o=t.inject(Oh,null);t.provide(Oh,null);const s=t.computed(i?()=>i(o):()=>{const{size:c}=n;if(c)return c;if(o){const{mergedSize:d}=o;if(d.value!==void 0)return d.value}return e}),a=t.computed(r?()=>r(o):()=>{const{disabled:c}=n;return c!==void 0?c:o?o.disabled.value:!1}),l=t.computed(()=>{const{status:c}=n;return c||(o==null?void 0:o.mergedValidationStatus.value)});return t.onBeforeUnmount(()=>{o&&o.restoreValidation()}),{mergedSizeRef:s,mergedDisabledRef:a,mergedStatusRef:l,nTriggerFormBlur(){o&&o.handleContentBlur()},nTriggerFormChange(){o&&o.handleContentChange()},nTriggerFormFocus(){o&&o.handleContentFocus()},nTriggerFormInput(){o&&o.handleContentInput()}}}const LS={name:"en-US",global:{undo:"Undo",redo:"Redo",confirm:"Confirm",clear:"Clear"},Popconfirm:{positiveText:"Confirm",negativeText:"Cancel"},Cascader:{placeholder:"Please Select",loading:"Loading",loadingRequiredMessage:n=>`Please load all ${n}'s descendants before checking it.`},Time:{dateFormat:"yyyy-MM-dd",dateTimeFormat:"yyyy-MM-dd HH:mm:ss"},DatePicker:{yearFormat:"yyyy",monthFormat:"MMM",dayFormat:"eeeeee",yearTypeFormat:"yyyy",monthTypeFormat:"yyyy-MM",dateFormat:"yyyy-MM-dd",dateTimeFormat:"yyyy-MM-dd HH:mm:ss",quarterFormat:"yyyy-qqq",weekFormat:"YYYY-w",clear:"Clear",now:"Now",confirm:"Confirm",selectTime:"Select Time",selectDate:"Select Date",datePlaceholder:"Select Date",datetimePlaceholder:"Select Date and Time",monthPlaceholder:"Select Month",yearPlaceholder:"Select Year",quarterPlaceholder:"Select Quarter",weekPlaceholder:"Select Week",startDatePlaceholder:"Start Date",endDatePlaceholder:"End Date",startDatetimePlaceholder:"Start Date and Time",endDatetimePlaceholder:"End Date and Time",startMonthPlaceholder:"Start Month",endMonthPlaceholder:"End Month",monthBeforeYear:!0,firstDayOfWeek:6,today:"Today"},DataTable:{checkTableAll:"Select all in the table",uncheckTableAll:"Unselect all in the table",confirm:"Confirm",clear:"Clear"},LegacyTransfer:{sourceTitle:"Source",targetTitle:"Target"},Transfer:{selectAll:"Select all",unselectAll:"Unselect all",clearAll:"Clear",total:n=>`Total ${n} items`,selected:n=>`${n} items selected`},Empty:{description:"No Data"},Select:{placeholder:"Please Select"},TimePicker:{placeholder:"Select Time",positiveText:"OK",negativeText:"Cancel",now:"Now",clear:"Clear"},Pagination:{goto:"Goto",selectionSuffix:"page"},DynamicTags:{add:"Add"},Log:{loading:"Loading"},Input:{placeholder:"Please Input"},InputNumber:{placeholder:"Please Input"},DynamicInput:{create:"Create"},ThemeEditor:{title:"Theme Editor",clearAllVars:"Clear All Variables",clearSearch:"Clear Search",filterCompName:"Filter Component Name",filterVarName:"Filter Variable Name",import:"Import",export:"Export",restore:"Reset to Default"},Image:{tipPrevious:"Previous picture (←)",tipNext:"Next picture (→)",tipCounterclockwise:"Counterclockwise",tipClockwise:"Clockwise",tipZoomOut:"Zoom out",tipZoomIn:"Zoom in",tipDownload:"Download",tipClose:"Close (Esc)",tipOriginalSize:"Zoom to original size"},Heatmap:{less:"less",more:"more",monthFormat:"MMM",weekdayFormat:"eee"}};function al(n){return(e={})=>{const i=e.width?String(e.width):n.defaultWidth;return n.formats[i]||n.formats[n.defaultWidth]}}function Yr(n){return(e,i)=>{const r=i!=null&&i.context?String(i.context):"standalone";let o;if(r==="formatting"&&n.formattingValues){const a=n.defaultFormattingWidth||n.defaultWidth,l=i!=null&&i.width?String(i.width):a;o=n.formattingValues[l]||n.formattingValues[a]}else{const a=n.defaultWidth,l=i!=null&&i.width?String(i.width):n.defaultWidth;o=n.values[l]||n.values[a]}const s=n.argumentCallback?n.argumentCallback(e):e;return o[s]}}function Ur(n){return(e,i={})=>{const r=i.width,o=r&&n.matchPatterns[r]||n.matchPatterns[n.defaultMatchWidth],s=e.match(o);if(!s)return null;const a=s[0],l=r&&n.parsePatterns[r]||n.parsePatterns[n.defaultParseWidth],c=Array.isArray(l)?WS(l,f=>f.test(a)):HS(l,f=>f.test(a));let d;d=n.valueCallback?n.valueCallback(c):c,d=i.valueCallback?i.valueCallback(d):d;const u=e.slice(a.length);return{value:d,rest:u}}}function HS(n,e){for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&e(n[i]))return i}function WS(n,e){for(let i=0;i<n.length;i++)if(e(n[i]))return i}function jS(n){return(e,i={})=>{const r=e.match(n.matchPattern);if(!r)return null;const o=r[0],s=e.match(n.parsePattern);if(!s)return null;let a=n.valueCallback?n.valueCallback(s[0]):s[0];a=i.valueCallback?i.valueCallback(a):a;const l=e.slice(o.length);return{value:a,rest:l}}}const qS={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},XS=(n,e,i)=>{let r;const o=qS[n];return typeof o=="string"?r=o:e===1?r=o.one:r=o.other.replace("{{count}}",e.toString()),i!=null&&i.addSuffix?i.comparison&&i.comparison>0?"in "+r:r+" ago":r},YS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},US=(n,e,i,r)=>YS[n],KS={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},GS={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ZS={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},QS={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},JS={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},eB={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},tB={ordinalNumber:(n,e)=>{const i=Number(n),r=i%100;if(r>20||r<10)switch(r%10){case 1:return i+"st";case 2:return i+"nd";case 3:return i+"rd"}return i+"th"},era:Yr({values:KS,defaultWidth:"wide"}),quarter:Yr({values:GS,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Yr({values:ZS,defaultWidth:"wide"}),day:Yr({values:QS,defaultWidth:"wide"}),dayPeriod:Yr({values:JS,defaultWidth:"wide",formattingValues:eB,defaultFormattingWidth:"wide"})},nB=/^(\d+)(th|st|nd|rd)?/i,iB=/\d+/i,rB={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},oB={any:[/^b/i,/^(a|c)/i]},sB={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},aB={any:[/1/i,/2/i,/3/i,/4/i]},lB={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},cB={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},dB={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},uB={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},fB={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},hB={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},mB={ordinalNumber:jS({matchPattern:nB,parsePattern:iB,valueCallback:n=>parseInt(n,10)}),era:Ur({matchPatterns:rB,defaultMatchWidth:"wide",parsePatterns:oB,defaultParseWidth:"any"}),quarter:Ur({matchPatterns:sB,defaultMatchWidth:"wide",parsePatterns:aB,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Ur({matchPatterns:lB,defaultMatchWidth:"wide",parsePatterns:cB,defaultParseWidth:"any"}),day:Ur({matchPatterns:dB,defaultMatchWidth:"wide",parsePatterns:uB,defaultParseWidth:"any"}),dayPeriod:Ur({matchPatterns:fB,defaultMatchWidth:"any",parsePatterns:hB,defaultParseWidth:"any"})},pB={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},gB={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},yB={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},bB={date:al({formats:pB,defaultWidth:"full"}),time:al({formats:gB,defaultWidth:"full"}),dateTime:al({formats:yB,defaultWidth:"full"})},_B={name:"en-US",locale:{code:"en-US",formatDistance:XS,formatLong:bB,formatRelative:US,localize:tB,match:mB,options:{weekStartsOn:0,firstWeekContainsDate:1}}};function zh(n){const{mergedLocaleRef:e,mergedDateLocaleRef:i}=t.inject(Ai,null)||{},r=t.computed(()=>{var s,a;return(a=(s=e==null?void 0:e.value)===null||s===void 0?void 0:s[n])!==null&&a!==void 0?a:LS[n]});return{dateLocaleRef:t.computed(()=>{var s;return(s=i==null?void 0:i.value)!==null&&s!==void 0?s:_B}),localeRef:r}}const Kr="naive-ui-style";function Gr(n,e,i){if(!e)return;const r=Fi(),o=t.computed(()=>{const{value:l}=e;if(!l)return;const c=l[n];if(c)return c}),s=t.inject(Ai,null),a=()=>{t.watchEffect(()=>{const{value:l}=i,c=`${l}${n}Rtl`;if(Wv(c,r))return;const{value:d}=o;d&&d.style.mount({id:c,head:!0,anchorMetaName:Kr,props:{bPrefix:l?`.${l}-`:void 0},ssr:r,parent:s==null?void 0:s.styleMountTarget})})};return r?a():t.onBeforeMount(a),o}const Zr={fontFamily:'v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontFamilyMono:"v-mono, SFMono-Regular, Menlo, Consolas, Courier, monospace",fontWeight:"400",fontWeightStrong:"500",cubicBezierEaseInOut:"cubic-bezier(.4, 0, .2, 1)",cubicBezierEaseOut:"cubic-bezier(0, 0, .2, 1)",cubicBezierEaseIn:"cubic-bezier(.4, 0, 1, 1)",borderRadius:"3px",borderRadiusSmall:"2px",fontSize:"14px",fontSizeMini:"12px",fontSizeTiny:"12px",fontSizeSmall:"14px",fontSizeMedium:"14px",fontSizeLarge:"15px",fontSizeHuge:"16px",lineHeight:"1.6",heightMini:"16px",heightTiny:"22px",heightSmall:"28px",heightMedium:"34px",heightLarge:"40px",heightHuge:"46px"},{fontSize:wB,fontFamily:xB,lineHeight:kB}=Zr,Dh=he("body",`
|
|
117
117
|
margin: 0;
|
|
118
118
|
font-size: ${wB};
|
|
119
119
|
font-family: ${xB};
|
|
@@ -123,7 +123,7 @@ ${o}
|
|
|
123
123
|
`,[he("input",`
|
|
124
124
|
font-family: inherit;
|
|
125
125
|
font-size: inherit;
|
|
126
|
-
`)]);var CB={};function ms(n,e,i){if(!e){CB.NODE_ENV!=="production"&&Ih("use-style","No style is specified.");return}const r=Fi(),o=t.inject(Ai,null),s=()=>{const a=i.value;e.mount({id:a===void 0?n:a+n,head:!0,anchorMetaName:Kr,props:{bPrefix:a?`.${a}-`:void 0},ssr:r,parent:o==null?void 0:o.styleMountTarget}),o!=null&&o.preflightStyleDisabled||Dh.mount({id:"n-global",head:!0,anchorMetaName:Kr,ssr:r,parent:o==null?void 0:o.styleMountTarget})};r?s():t.onBeforeMount(s)}function
|
|
126
|
+
`)]);var CB={};function ms(n,e,i){if(!e){CB.NODE_ENV!=="production"&&Ih("use-style","No style is specified.");return}const r=Fi(),o=t.inject(Ai,null),s=()=>{const a=i.value;e.mount({id:a===void 0?n:a+n,head:!0,anchorMetaName:Kr,props:{bPrefix:a?`.${a}-`:void 0},ssr:r,parent:o==null?void 0:o.styleMountTarget}),o!=null&&o.preflightStyleDisabled||Dh.mount({id:"n-global",head:!0,anchorMetaName:Kr,ssr:r,parent:o==null?void 0:o.styleMountTarget})};r?s():t.onBeforeMount(s)}function AT(n){return n}function Tt(n,e,i,r,o,s){const a=Fi(),l=t.inject(Ai,null);if(i){const d=()=>{const u=s==null?void 0:s.value;i.mount({id:u===void 0?e:u+e,head:!0,props:{bPrefix:u?`.${u}-`:void 0},anchorMetaName:Kr,ssr:a,parent:l==null?void 0:l.styleMountTarget}),l!=null&&l.preflightStyleDisabled||Dh.mount({id:"n-global",head:!0,anchorMetaName:Kr,ssr:a,parent:l==null?void 0:l.styleMountTarget})};a?d():t.onBeforeMount(d)}return t.computed(()=>{var d;const{theme:{common:u,self:f,peers:h={}}={},themeOverrides:p={},builtinThemeOverrides:m={}}=o,{common:g,peers:b}=p,{common:y=void 0,[n]:{common:_=void 0,self:k=void 0,peers:x={}}={}}=(l==null?void 0:l.mergedThemeRef.value)||{},{common:v=void 0,[n]:B={}}=(l==null?void 0:l.mergedThemeOverridesRef.value)||{},{common:w,peers:T={}}=B,C=M.merge({},u||_||y||r.common,v,w,g),$=M.merge((d=f||k||r.self)===null||d===void 0?void 0:d(C),m,B,p);return{common:C,self:$,peers:M.merge({},r.peers,x,h),peerOverrides:M.merge({},m.peers,T,b)}})}Tt.props={theme:Object,themeOverrides:Object,builtinThemeOverrides:Object};const vB=_e("base-icon",`
|
|
127
127
|
height: 1em;
|
|
128
128
|
width: 1em;
|
|
129
129
|
line-height: 1em;
|
|
@@ -810,7 +810,7 @@ ${o}
|
|
|
810
810
|
line-height: 1.25;
|
|
811
811
|
text-overflow: ellipsis;
|
|
812
812
|
overflow: hidden;
|
|
813
|
-
`)])])]),B5=t.defineComponent({name:"InternalSelection",props:Object.assign(Object.assign({},Tt.props),{clsPrefix:{type:String,required:!0},bordered:{type:Boolean,default:void 0},active:Boolean,pattern:{type:String,default:""},placeholder:String,selectedOption:{type:Object,default:null},selectedOptions:{type:Array,default:null},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},multiple:Boolean,filterable:Boolean,clearable:Boolean,disabled:Boolean,size:{type:String,default:"medium"},loading:Boolean,autofocus:Boolean,showArrow:{type:Boolean,default:!0},inputProps:Object,focused:Boolean,renderTag:Function,onKeydown:Function,onClick:Function,onBlur:Function,onFocus:Function,onDeleteOption:Function,maxTagCount:[String,Number],ellipsisTagPopoverProps:Object,onClear:Function,onPatternInput:Function,onPatternFocus:Function,onPatternBlur:Function,renderLabel:Function,status:String,inlineThemeDisabled:Boolean,ignoreComposition:{type:Boolean,default:!0},onResize:Function}),setup(n){const{mergedClsPrefixRef:e,mergedRtlRef:i}=Oi(n),r=Gr("InternalSelection",i,e),o=t.ref(null),s=t.ref(null),a=t.ref(null),l=t.ref(null),c=t.ref(null),d=t.ref(null),u=t.ref(null),f=t.ref(null),h=t.ref(null),p=t.ref(null),m=t.ref(!1),g=t.ref(!1),b=t.ref(!1),y=Tt("InternalSelection","-internal-selection",S5,im,n,t.toRef(n,"clsPrefix")),_=t.computed(()=>n.clearable&&!n.disabled&&(b.value||n.active)),k=t.computed(()=>n.selectedOption?n.renderTag?n.renderTag({option:n.selectedOption,handleClose:()=>{}}):n.renderLabel?n.renderLabel(n.selectedOption,!0):yr(n.selectedOption[n.labelField],n.selectedOption,!0):n.placeholder),x=t.computed(()=>{const se=n.selectedOption;if(se)return se[n.labelField]}),v=t.computed(()=>n.multiple?!!(Array.isArray(n.selectedOptions)&&n.selectedOptions.length):n.selectedOption!==null);function B(){var se;const{value:de}=o;if(de){const{value:Re}=s;Re&&(Re.style.width=`${de.offsetWidth}px`,n.maxTagCount!=="responsive"&&((se=h.value)===null||se===void 0||se.sync({showAllItemsBeforeCalculate:!1})))}}function w(){const{value:se}=p;se&&(se.style.display="none")}function T(){const{value:se}=p;se&&(se.style.display="inline-block")}t.watch(t.toRef(n,"active"),se=>{se||w()}),t.watch(t.toRef(n,"pattern"),()=>{n.multiple&&t.nextTick(B)});function C(se){const{onFocus:de}=n;de&&de(se)}function $(se){const{onBlur:de}=n;de&&de(se)}function E(se){const{onDeleteOption:de}=n;de&&de(se)}function I(se){const{onClear:de}=n;de&&de(se)}function R(se){const{onPatternInput:de}=n;de&&de(se)}function O(se){var de;(!se.relatedTarget||!(!((de=a.value)===null||de===void 0)&&de.contains(se.relatedTarget)))&&C(se)}function U(se){var de;!((de=a.value)===null||de===void 0)&&de.contains(se.relatedTarget)||$(se)}function Q(se){I(se)}function G(){b.value=!0}function W(){b.value=!1}function D(se){!n.active||!n.filterable||se.target!==s.value&&se.preventDefault()}function L(se){E(se)}const z=t.ref(!1);function P(se){if(se.key==="Backspace"&&!z.value&&!n.pattern.length){const{selectedOptions:de}=n;de!=null&&de.length&&L(de[de.length-1])}}let q=null;function K(se){const{value:de}=o;if(de){const Re=se.target.value;de.textContent=Re,B()}n.ignoreComposition&&z.value?q=se:R(se)}function J(){z.value=!0}function Y(){z.value=!1,n.ignoreComposition&&R(q),q=null}function V(se){var de;g.value=!0,(de=n.onPatternFocus)===null||de===void 0||de.call(n,se)}function A(se){var de;g.value=!1,(de=n.onPatternBlur)===null||de===void 0||de.call(n,se)}function ie(){var se,de;if(n.filterable)g.value=!1,(se=d.value)===null||se===void 0||se.blur(),(de=s.value)===null||de===void 0||de.blur();else if(n.multiple){const{value:Re}=l;Re==null||Re.blur()}else{const{value:Re}=c;Re==null||Re.blur()}}function ce(){var se,de,Re;n.filterable?(g.value=!1,(se=d.value)===null||se===void 0||se.focus()):n.multiple?(de=l.value)===null||de===void 0||de.focus():(Re=c.value)===null||Re===void 0||Re.focus()}function pe(){const{value:se}=s;se&&(T(),se.focus())}function at(){const{value:se}=s;se&&se.blur()}function we(se){const{value:de}=u;de&&de.setTextContent(`+${se}`)}function ke(){const{value:se}=f;return se}function kt(){return s.value}let Ne=null;function Jt(){Ne!==null&&window.clearTimeout(Ne)}function wn(){n.active||(Jt(),Ne=window.setTimeout(()=>{v.value&&(m.value=!0)},100))}function Pt(){Jt()}function ni(se){se||(Jt(),m.value=!1)}t.watch(v,se=>{se||(m.value=!1)}),t.onMounted(()=>{t.watchEffect(()=>{const se=d.value;se&&(n.disabled?se.removeAttribute("tabindex"):se.tabIndex=g.value?-1:0)})}),Bh(a,n.onResize);const{inlineThemeDisabled:On}=n,cn=t.computed(()=>{const{size:se}=n,{common:{cubicBezierEaseInOut:de},self:{fontWeight:Re,borderRadius:qe,color:dn,placeholderColor:Kt,textColor:ii,paddingSingle:it,paddingMultiple:en,caretColor:br,colorDisabled:xn,textColorDisabled:ri,placeholderColorDisabled:H,colorActive:Z,boxShadowFocus:ae,boxShadowActive:me,boxShadowHover:ye,border:Ce,borderFocus:Be,borderHover:$e,borderActive:et,arrowColor:zn,arrowColorDisabled:_l,loadingColor:wl,colorActiveWarning:xl,boxShadowFocusWarning:kl,boxShadowActiveWarning:Cl,boxShadowHoverWarning:vl,borderWarning:Sl,borderFocusWarning:Bl,borderHoverWarning:Nl,borderActiveWarning:Tl,colorActiveError:$l,boxShadowFocusError:El,boxShadowActiveError:Rl,boxShadowHoverError:Pl,borderError:Fl,borderFocusError:Vl,borderHoverError:Ml,borderActiveError:_T,clearColor:wT,clearColorHover:xT,clearColorPressed:kT,clearSize:CT,arrowSize:vT,[nt("height",se)]:ST,[nt("fontSize",se)]:BT}}=y.value,bs=yn(it),_s=yn(en);return{"--n-bezier":de,"--n-border":Ce,"--n-border-active":et,"--n-border-focus":Be,"--n-border-hover":$e,"--n-border-radius":qe,"--n-box-shadow-active":me,"--n-box-shadow-focus":ae,"--n-box-shadow-hover":ye,"--n-caret-color":br,"--n-color":dn,"--n-color-active":Z,"--n-color-disabled":xn,"--n-font-size":BT,"--n-height":ST,"--n-padding-single-top":bs.top,"--n-padding-multiple-top":_s.top,"--n-padding-single-right":bs.right,"--n-padding-multiple-right":_s.right,"--n-padding-single-left":bs.left,"--n-padding-multiple-left":_s.left,"--n-padding-single-bottom":bs.bottom,"--n-padding-multiple-bottom":_s.bottom,"--n-placeholder-color":Kt,"--n-placeholder-color-disabled":H,"--n-text-color":ii,"--n-text-color-disabled":ri,"--n-arrow-color":zn,"--n-arrow-color-disabled":_l,"--n-loading-color":wl,"--n-color-active-warning":xl,"--n-box-shadow-focus-warning":kl,"--n-box-shadow-active-warning":Cl,"--n-box-shadow-hover-warning":vl,"--n-border-warning":Sl,"--n-border-focus-warning":Bl,"--n-border-hover-warning":Nl,"--n-border-active-warning":Tl,"--n-color-active-error":$l,"--n-box-shadow-focus-error":El,"--n-box-shadow-active-error":Rl,"--n-box-shadow-hover-error":Pl,"--n-border-error":Fl,"--n-border-focus-error":Vl,"--n-border-hover-error":Ml,"--n-border-active-error":_T,"--n-clear-size":CT,"--n-clear-color":wT,"--n-clear-color-hover":xT,"--n-clear-color-pressed":kT,"--n-arrow-size":vT,"--n-font-weight":Re}}),pt=On?zi("internal-selection",t.computed(()=>n.size[0]),cn,n):void 0;return{mergedTheme:y,mergedClearable:_,mergedClsPrefix:e,rtlEnabled:r,patternInputFocused:g,filterablePlaceholder:k,label:x,selected:v,showTagsPanel:m,isComposing:z,counterRef:u,counterWrapperRef:f,patternInputMirrorRef:o,patternInputRef:s,selfRef:a,multipleElRef:l,singleElRef:c,patternInputWrapperRef:d,overflowRef:h,inputTagElRef:p,handleMouseDown:D,handleFocusin:O,handleClear:Q,handleMouseEnter:G,handleMouseLeave:W,handleDeleteOption:L,handlePatternKeyDown:P,handlePatternInputInput:K,handlePatternInputBlur:A,handlePatternInputFocus:V,handleMouseEnterCounter:wn,handleMouseLeaveCounter:Pt,handleFocusout:U,handleCompositionEnd:Y,handleCompositionStart:J,onPopoverUpdateShow:ni,focus:ce,focusInput:pe,blur:ie,blurInput:at,updateCounter:we,getCounter:ke,getTail:kt,renderLabel:n.renderLabel,cssVars:On?void 0:cn,themeClass:pt==null?void 0:pt.themeClass,onRender:pt==null?void 0:pt.onRender}},render(){const{status:n,multiple:e,size:i,disabled:r,filterable:o,maxTagCount:s,bordered:a,clsPrefix:l,ellipsisTagPopoverProps:c,onRender:d,renderTag:u,renderLabel:f}=this;d==null||d();const h=s==="responsive",p=typeof s=="number",m=h||p,g=t.h(sl,null,{default:()=>t.h(k5,{clsPrefix:l,loading:this.loading,showArrow:this.showArrow,showClear:this.mergedClearable&&this.selected,onClear:this.handleClear},{default:()=>{var y,_;return(_=(y=this.$slots).arrow)===null||_===void 0?void 0:_.call(y)}})});let b;if(e){const{labelField:y}=this,_=R=>t.h("div",{class:`${l}-base-selection-tag-wrapper`,key:R.value},u?u({option:R,handleClose:()=>{this.handleDeleteOption(R)}}):t.h(fl,{size:i,closable:!R.disabled,disabled:r,onClose:()=>{this.handleDeleteOption(R)},internalCloseIsButtonTag:!1,internalCloseFocusable:!1},{default:()=>f?f(R,!0):yr(R[y],R,!0)})),k=()=>(p?this.selectedOptions.slice(0,s):this.selectedOptions).map(_),x=o?t.h("div",{class:`${l}-base-selection-input-tag`,ref:"inputTagElRef",key:"__input-tag__"},t.h("input",Object.assign({},this.inputProps,{ref:"patternInputRef",tabindex:-1,disabled:r,value:this.pattern,autofocus:this.autofocus,class:`${l}-base-selection-input-tag__input`,onBlur:this.handlePatternInputBlur,onFocus:this.handlePatternInputFocus,onKeydown:this.handlePatternKeyDown,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),t.h("span",{ref:"patternInputMirrorRef",class:`${l}-base-selection-input-tag__mirror`},this.pattern)):null,v=h?()=>t.h("div",{class:`${l}-base-selection-tag-wrapper`,ref:"counterWrapperRef"},t.h(fl,{size:i,ref:"counterRef",onMouseenter:this.handleMouseEnterCounter,onMouseleave:this.handleMouseLeaveCounter,disabled:r})):void 0;let B;if(p){const R=this.selectedOptions.length-s;R>0&&(B=t.h("div",{class:`${l}-base-selection-tag-wrapper`,key:"__counter__"},t.h(fl,{size:i,ref:"counterRef",onMouseenter:this.handleMouseEnterCounter,disabled:r},{default:()=>`+${R}`})))}const w=h?o?t.h(gh,{ref:"overflowRef",updateCounter:this.updateCounter,getCounter:this.getCounter,getTail:this.getTail,style:{width:"100%",display:"flex",overflow:"hidden"}},{default:k,counter:v,tail:()=>x}):t.h(gh,{ref:"overflowRef",updateCounter:this.updateCounter,getCounter:this.getCounter,style:{width:"100%",display:"flex",overflow:"hidden"}},{default:k,counter:v}):p&&B?k().concat(B):k(),T=m?()=>t.h("div",{class:`${l}-base-selection-popover`},h?k():this.selectedOptions.map(_)):void 0,C=m?Object.assign({show:this.showTagsPanel,trigger:"hover",overlap:!0,placement:"top",width:"trigger",onUpdateShow:this.onPopoverUpdateShow,theme:this.mergedTheme.peers.Popover,themeOverrides:this.mergedTheme.peerOverrides.Popover},c):null,E=(this.selected?!1:this.active?!this.pattern&&!this.isComposing:!0)?t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`},t.h("div",{class:`${l}-base-selection-placeholder__inner`},this.placeholder)):null,I=o?t.h("div",{ref:"patternInputWrapperRef",class:`${l}-base-selection-tags`},w,h?null:x,g):t.h("div",{ref:"multipleElRef",class:`${l}-base-selection-tags`,tabindex:r?void 0:0},w,g);b=t.h(t.Fragment,null,m?t.h(h5,Object.assign({},C,{scrollable:!0,style:"max-height: calc(var(--v-target-height) * 6.6);"}),{trigger:()=>I,default:T}):I,E)}else if(o){const y=this.pattern||this.isComposing,_=this.active?!y:!this.selected,k=this.active?!1:this.selected;b=t.h("div",{ref:"patternInputWrapperRef",class:`${l}-base-selection-label`,title:this.patternInputFocused?void 0:Fh(this.label)},t.h("input",Object.assign({},this.inputProps,{ref:"patternInputRef",class:`${l}-base-selection-input`,value:this.active?this.pattern:"",placeholder:"",readonly:r,disabled:r,tabindex:-1,autofocus:this.autofocus,onFocus:this.handlePatternInputFocus,onBlur:this.handlePatternInputBlur,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),k?t.h("div",{class:`${l}-base-selection-label__render-label ${l}-base-selection-overlay`,key:"input"},t.h("div",{class:`${l}-base-selection-overlay__wrapper`},u?u({option:this.selectedOption,handleClose:()=>{}}):f?f(this.selectedOption,!0):yr(this.label,this.selectedOption,!0))):null,_?t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:"placeholder"},t.h("div",{class:`${l}-base-selection-overlay__wrapper`},this.filterablePlaceholder)):null,g)}else b=t.h("div",{ref:"singleElRef",class:`${l}-base-selection-label`,tabindex:this.disabled?void 0:0},this.label!==void 0?t.h("div",{class:`${l}-base-selection-input`,title:Fh(this.label),key:"input"},t.h("div",{class:`${l}-base-selection-input__content`},u?u({option:this.selectedOption,handleClose:()=>{}}):f?f(this.selectedOption,!0):yr(this.label,this.selectedOption,!0))):t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:"placeholder"},t.h("div",{class:`${l}-base-selection-placeholder__inner`},this.placeholder)),g);return t.h("div",{ref:"selfRef",class:[`${l}-base-selection`,this.rtlEnabled&&`${l}-base-selection--rtl`,this.themeClass,n&&`${l}-base-selection--${n}-status`,{[`${l}-base-selection--active`]:this.active,[`${l}-base-selection--selected`]:this.selected||this.active&&this.pattern,[`${l}-base-selection--disabled`]:this.disabled,[`${l}-base-selection--multiple`]:this.multiple,[`${l}-base-selection--focus`]:this.focused}],style:this.cssVars,onClick:this.onClick,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onKeydown:this.onKeydown,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onMousedown:this.handleMouseDown},b,a?t.h("div",{class:`${l}-base-selection__border`}):null,a?t.h("div",{class:`${l}-base-selection__state-border`}):null)}});function N5(n){const{boxShadow2:e}=n;return{menuBoxShadow:e}}const T5={name:"Select",common:Di,peers:{InternalSelection:im,InternalSelectMenu:Kh},self:N5},$5=he([_e("select",`
|
|
813
|
+
`)])])]),B5=t.defineComponent({name:"InternalSelection",props:Object.assign(Object.assign({},Tt.props),{clsPrefix:{type:String,required:!0},bordered:{type:Boolean,default:void 0},active:Boolean,pattern:{type:String,default:""},placeholder:String,selectedOption:{type:Object,default:null},selectedOptions:{type:Array,default:null},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},multiple:Boolean,filterable:Boolean,clearable:Boolean,disabled:Boolean,size:{type:String,default:"medium"},loading:Boolean,autofocus:Boolean,showArrow:{type:Boolean,default:!0},inputProps:Object,focused:Boolean,renderTag:Function,onKeydown:Function,onClick:Function,onBlur:Function,onFocus:Function,onDeleteOption:Function,maxTagCount:[String,Number],ellipsisTagPopoverProps:Object,onClear:Function,onPatternInput:Function,onPatternFocus:Function,onPatternBlur:Function,renderLabel:Function,status:String,inlineThemeDisabled:Boolean,ignoreComposition:{type:Boolean,default:!0},onResize:Function}),setup(n){const{mergedClsPrefixRef:e,mergedRtlRef:i}=Oi(n),r=Gr("InternalSelection",i,e),o=t.ref(null),s=t.ref(null),a=t.ref(null),l=t.ref(null),c=t.ref(null),d=t.ref(null),u=t.ref(null),f=t.ref(null),h=t.ref(null),p=t.ref(null),m=t.ref(!1),g=t.ref(!1),b=t.ref(!1),y=Tt("InternalSelection","-internal-selection",S5,im,n,t.toRef(n,"clsPrefix")),_=t.computed(()=>n.clearable&&!n.disabled&&(b.value||n.active)),k=t.computed(()=>n.selectedOption?n.renderTag?n.renderTag({option:n.selectedOption,handleClose:()=>{}}):n.renderLabel?n.renderLabel(n.selectedOption,!0):yr(n.selectedOption[n.labelField],n.selectedOption,!0):n.placeholder),x=t.computed(()=>{const se=n.selectedOption;if(se)return se[n.labelField]}),v=t.computed(()=>n.multiple?!!(Array.isArray(n.selectedOptions)&&n.selectedOptions.length):n.selectedOption!==null);function B(){var se;const{value:de}=o;if(de){const{value:Re}=s;Re&&(Re.style.width=`${de.offsetWidth}px`,n.maxTagCount!=="responsive"&&((se=h.value)===null||se===void 0||se.sync({showAllItemsBeforeCalculate:!1})))}}function w(){const{value:se}=p;se&&(se.style.display="none")}function T(){const{value:se}=p;se&&(se.style.display="inline-block")}t.watch(t.toRef(n,"active"),se=>{se||w()}),t.watch(t.toRef(n,"pattern"),()=>{n.multiple&&t.nextTick(B)});function C(se){const{onFocus:de}=n;de&&de(se)}function $(se){const{onBlur:de}=n;de&&de(se)}function E(se){const{onDeleteOption:de}=n;de&&de(se)}function I(se){const{onClear:de}=n;de&&de(se)}function R(se){const{onPatternInput:de}=n;de&&de(se)}function O(se){var de;(!se.relatedTarget||!(!((de=a.value)===null||de===void 0)&&de.contains(se.relatedTarget)))&&C(se)}function U(se){var de;!((de=a.value)===null||de===void 0)&&de.contains(se.relatedTarget)||$(se)}function Q(se){I(se)}function G(){b.value=!0}function W(){b.value=!1}function D(se){!n.active||!n.filterable||se.target!==s.value&&se.preventDefault()}function L(se){E(se)}const z=t.ref(!1);function P(se){if(se.key==="Backspace"&&!z.value&&!n.pattern.length){const{selectedOptions:de}=n;de!=null&&de.length&&L(de[de.length-1])}}let q=null;function K(se){const{value:de}=o;if(de){const Re=se.target.value;de.textContent=Re,B()}n.ignoreComposition&&z.value?q=se:R(se)}function J(){z.value=!0}function Y(){z.value=!1,n.ignoreComposition&&R(q),q=null}function V(se){var de;g.value=!0,(de=n.onPatternFocus)===null||de===void 0||de.call(n,se)}function A(se){var de;g.value=!1,(de=n.onPatternBlur)===null||de===void 0||de.call(n,se)}function ie(){var se,de;if(n.filterable)g.value=!1,(se=d.value)===null||se===void 0||se.blur(),(de=s.value)===null||de===void 0||de.blur();else if(n.multiple){const{value:Re}=l;Re==null||Re.blur()}else{const{value:Re}=c;Re==null||Re.blur()}}function ce(){var se,de,Re;n.filterable?(g.value=!1,(se=d.value)===null||se===void 0||se.focus()):n.multiple?(de=l.value)===null||de===void 0||de.focus():(Re=c.value)===null||Re===void 0||Re.focus()}function pe(){const{value:se}=s;se&&(T(),se.focus())}function at(){const{value:se}=s;se&&se.blur()}function we(se){const{value:de}=u;de&&de.setTextContent(`+${se}`)}function ke(){const{value:se}=f;return se}function kt(){return s.value}let Ne=null;function Jt(){Ne!==null&&window.clearTimeout(Ne)}function wn(){n.active||(Jt(),Ne=window.setTimeout(()=>{v.value&&(m.value=!0)},100))}function Pt(){Jt()}function ni(se){se||(Jt(),m.value=!1)}t.watch(v,se=>{se||(m.value=!1)}),t.onMounted(()=>{t.watchEffect(()=>{const se=d.value;se&&(n.disabled?se.removeAttribute("tabindex"):se.tabIndex=g.value?-1:0)})}),Bh(a,n.onResize);const{inlineThemeDisabled:On}=n,cn=t.computed(()=>{const{size:se}=n,{common:{cubicBezierEaseInOut:de},self:{fontWeight:Re,borderRadius:qe,color:dn,placeholderColor:Kt,textColor:ii,paddingSingle:it,paddingMultiple:en,caretColor:br,colorDisabled:xn,textColorDisabled:ri,placeholderColorDisabled:H,colorActive:Z,boxShadowFocus:ae,boxShadowActive:me,boxShadowHover:ye,border:Ce,borderFocus:Be,borderHover:$e,borderActive:et,arrowColor:zn,arrowColorDisabled:_l,loadingColor:wl,colorActiveWarning:xl,boxShadowFocusWarning:kl,boxShadowActiveWarning:Cl,boxShadowHoverWarning:vl,borderWarning:Sl,borderFocusWarning:Bl,borderHoverWarning:Nl,borderActiveWarning:Tl,colorActiveError:$l,boxShadowFocusError:El,boxShadowActiveError:Rl,boxShadowHoverError:Pl,borderError:Fl,borderFocusError:Vl,borderHoverError:Ml,borderActiveError:xT,clearColor:kT,clearColorHover:CT,clearColorPressed:vT,clearSize:ST,arrowSize:BT,[nt("height",se)]:NT,[nt("fontSize",se)]:TT}}=y.value,bs=yn(it),_s=yn(en);return{"--n-bezier":de,"--n-border":Ce,"--n-border-active":et,"--n-border-focus":Be,"--n-border-hover":$e,"--n-border-radius":qe,"--n-box-shadow-active":me,"--n-box-shadow-focus":ae,"--n-box-shadow-hover":ye,"--n-caret-color":br,"--n-color":dn,"--n-color-active":Z,"--n-color-disabled":xn,"--n-font-size":TT,"--n-height":NT,"--n-padding-single-top":bs.top,"--n-padding-multiple-top":_s.top,"--n-padding-single-right":bs.right,"--n-padding-multiple-right":_s.right,"--n-padding-single-left":bs.left,"--n-padding-multiple-left":_s.left,"--n-padding-single-bottom":bs.bottom,"--n-padding-multiple-bottom":_s.bottom,"--n-placeholder-color":Kt,"--n-placeholder-color-disabled":H,"--n-text-color":ii,"--n-text-color-disabled":ri,"--n-arrow-color":zn,"--n-arrow-color-disabled":_l,"--n-loading-color":wl,"--n-color-active-warning":xl,"--n-box-shadow-focus-warning":kl,"--n-box-shadow-active-warning":Cl,"--n-box-shadow-hover-warning":vl,"--n-border-warning":Sl,"--n-border-focus-warning":Bl,"--n-border-hover-warning":Nl,"--n-border-active-warning":Tl,"--n-color-active-error":$l,"--n-box-shadow-focus-error":El,"--n-box-shadow-active-error":Rl,"--n-box-shadow-hover-error":Pl,"--n-border-error":Fl,"--n-border-focus-error":Vl,"--n-border-hover-error":Ml,"--n-border-active-error":xT,"--n-clear-size":ST,"--n-clear-color":kT,"--n-clear-color-hover":CT,"--n-clear-color-pressed":vT,"--n-arrow-size":BT,"--n-font-weight":Re}}),pt=On?zi("internal-selection",t.computed(()=>n.size[0]),cn,n):void 0;return{mergedTheme:y,mergedClearable:_,mergedClsPrefix:e,rtlEnabled:r,patternInputFocused:g,filterablePlaceholder:k,label:x,selected:v,showTagsPanel:m,isComposing:z,counterRef:u,counterWrapperRef:f,patternInputMirrorRef:o,patternInputRef:s,selfRef:a,multipleElRef:l,singleElRef:c,patternInputWrapperRef:d,overflowRef:h,inputTagElRef:p,handleMouseDown:D,handleFocusin:O,handleClear:Q,handleMouseEnter:G,handleMouseLeave:W,handleDeleteOption:L,handlePatternKeyDown:P,handlePatternInputInput:K,handlePatternInputBlur:A,handlePatternInputFocus:V,handleMouseEnterCounter:wn,handleMouseLeaveCounter:Pt,handleFocusout:U,handleCompositionEnd:Y,handleCompositionStart:J,onPopoverUpdateShow:ni,focus:ce,focusInput:pe,blur:ie,blurInput:at,updateCounter:we,getCounter:ke,getTail:kt,renderLabel:n.renderLabel,cssVars:On?void 0:cn,themeClass:pt==null?void 0:pt.themeClass,onRender:pt==null?void 0:pt.onRender}},render(){const{status:n,multiple:e,size:i,disabled:r,filterable:o,maxTagCount:s,bordered:a,clsPrefix:l,ellipsisTagPopoverProps:c,onRender:d,renderTag:u,renderLabel:f}=this;d==null||d();const h=s==="responsive",p=typeof s=="number",m=h||p,g=t.h(sl,null,{default:()=>t.h(k5,{clsPrefix:l,loading:this.loading,showArrow:this.showArrow,showClear:this.mergedClearable&&this.selected,onClear:this.handleClear},{default:()=>{var y,_;return(_=(y=this.$slots).arrow)===null||_===void 0?void 0:_.call(y)}})});let b;if(e){const{labelField:y}=this,_=R=>t.h("div",{class:`${l}-base-selection-tag-wrapper`,key:R.value},u?u({option:R,handleClose:()=>{this.handleDeleteOption(R)}}):t.h(fl,{size:i,closable:!R.disabled,disabled:r,onClose:()=>{this.handleDeleteOption(R)},internalCloseIsButtonTag:!1,internalCloseFocusable:!1},{default:()=>f?f(R,!0):yr(R[y],R,!0)})),k=()=>(p?this.selectedOptions.slice(0,s):this.selectedOptions).map(_),x=o?t.h("div",{class:`${l}-base-selection-input-tag`,ref:"inputTagElRef",key:"__input-tag__"},t.h("input",Object.assign({},this.inputProps,{ref:"patternInputRef",tabindex:-1,disabled:r,value:this.pattern,autofocus:this.autofocus,class:`${l}-base-selection-input-tag__input`,onBlur:this.handlePatternInputBlur,onFocus:this.handlePatternInputFocus,onKeydown:this.handlePatternKeyDown,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),t.h("span",{ref:"patternInputMirrorRef",class:`${l}-base-selection-input-tag__mirror`},this.pattern)):null,v=h?()=>t.h("div",{class:`${l}-base-selection-tag-wrapper`,ref:"counterWrapperRef"},t.h(fl,{size:i,ref:"counterRef",onMouseenter:this.handleMouseEnterCounter,onMouseleave:this.handleMouseLeaveCounter,disabled:r})):void 0;let B;if(p){const R=this.selectedOptions.length-s;R>0&&(B=t.h("div",{class:`${l}-base-selection-tag-wrapper`,key:"__counter__"},t.h(fl,{size:i,ref:"counterRef",onMouseenter:this.handleMouseEnterCounter,disabled:r},{default:()=>`+${R}`})))}const w=h?o?t.h(gh,{ref:"overflowRef",updateCounter:this.updateCounter,getCounter:this.getCounter,getTail:this.getTail,style:{width:"100%",display:"flex",overflow:"hidden"}},{default:k,counter:v,tail:()=>x}):t.h(gh,{ref:"overflowRef",updateCounter:this.updateCounter,getCounter:this.getCounter,style:{width:"100%",display:"flex",overflow:"hidden"}},{default:k,counter:v}):p&&B?k().concat(B):k(),T=m?()=>t.h("div",{class:`${l}-base-selection-popover`},h?k():this.selectedOptions.map(_)):void 0,C=m?Object.assign({show:this.showTagsPanel,trigger:"hover",overlap:!0,placement:"top",width:"trigger",onUpdateShow:this.onPopoverUpdateShow,theme:this.mergedTheme.peers.Popover,themeOverrides:this.mergedTheme.peerOverrides.Popover},c):null,E=(this.selected?!1:this.active?!this.pattern&&!this.isComposing:!0)?t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`},t.h("div",{class:`${l}-base-selection-placeholder__inner`},this.placeholder)):null,I=o?t.h("div",{ref:"patternInputWrapperRef",class:`${l}-base-selection-tags`},w,h?null:x,g):t.h("div",{ref:"multipleElRef",class:`${l}-base-selection-tags`,tabindex:r?void 0:0},w,g);b=t.h(t.Fragment,null,m?t.h(h5,Object.assign({},C,{scrollable:!0,style:"max-height: calc(var(--v-target-height) * 6.6);"}),{trigger:()=>I,default:T}):I,E)}else if(o){const y=this.pattern||this.isComposing,_=this.active?!y:!this.selected,k=this.active?!1:this.selected;b=t.h("div",{ref:"patternInputWrapperRef",class:`${l}-base-selection-label`,title:this.patternInputFocused?void 0:Fh(this.label)},t.h("input",Object.assign({},this.inputProps,{ref:"patternInputRef",class:`${l}-base-selection-input`,value:this.active?this.pattern:"",placeholder:"",readonly:r,disabled:r,tabindex:-1,autofocus:this.autofocus,onFocus:this.handlePatternInputFocus,onBlur:this.handlePatternInputBlur,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),k?t.h("div",{class:`${l}-base-selection-label__render-label ${l}-base-selection-overlay`,key:"input"},t.h("div",{class:`${l}-base-selection-overlay__wrapper`},u?u({option:this.selectedOption,handleClose:()=>{}}):f?f(this.selectedOption,!0):yr(this.label,this.selectedOption,!0))):null,_?t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:"placeholder"},t.h("div",{class:`${l}-base-selection-overlay__wrapper`},this.filterablePlaceholder)):null,g)}else b=t.h("div",{ref:"singleElRef",class:`${l}-base-selection-label`,tabindex:this.disabled?void 0:0},this.label!==void 0?t.h("div",{class:`${l}-base-selection-input`,title:Fh(this.label),key:"input"},t.h("div",{class:`${l}-base-selection-input__content`},u?u({option:this.selectedOption,handleClose:()=>{}}):f?f(this.selectedOption,!0):yr(this.label,this.selectedOption,!0))):t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:"placeholder"},t.h("div",{class:`${l}-base-selection-placeholder__inner`},this.placeholder)),g);return t.h("div",{ref:"selfRef",class:[`${l}-base-selection`,this.rtlEnabled&&`${l}-base-selection--rtl`,this.themeClass,n&&`${l}-base-selection--${n}-status`,{[`${l}-base-selection--active`]:this.active,[`${l}-base-selection--selected`]:this.selected||this.active&&this.pattern,[`${l}-base-selection--disabled`]:this.disabled,[`${l}-base-selection--multiple`]:this.multiple,[`${l}-base-selection--focus`]:this.focused}],style:this.cssVars,onClick:this.onClick,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onKeydown:this.onKeydown,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onMousedown:this.handleMouseDown},b,a?t.h("div",{class:`${l}-base-selection__border`}):null,a?t.h("div",{class:`${l}-base-selection__state-border`}):null)}});function N5(n){const{boxShadow2:e}=n;return{menuBoxShadow:e}}const T5={name:"Select",common:Di,peers:{InternalSelection:im,InternalSelectMenu:Kh},self:N5},$5=he([_e("select",`
|
|
814
814
|
z-index: auto;
|
|
815
815
|
outline: none;
|
|
816
816
|
width: 100%;
|
|
@@ -819,4 +819,4 @@ ${o}
|
|
|
819
819
|
`),_e("select-menu",`
|
|
820
820
|
margin: 4px 0;
|
|
821
821
|
box-shadow: var(--n-menu-box-shadow);
|
|
822
|
-
`,[em({originalTransition:"background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)"})])]);function ps(n){return n.type==="group"}function rm(n){return n.type==="ignored"}function hl(n,e){try{return!!(1+e.toString().toLowerCase().indexOf(n.trim().toLowerCase()))}catch{return!1}}function E5(n,e){return{getIsGroup:ps,getIgnored:rm,getKey(r){return ps(r)?r.name||r.key||"key-required":r[n]},getChildren(r){return r[e]}}}function R5(n,e,i,r){if(!e)return n;function o(s){if(!Array.isArray(s))return[];const a=[];for(const l of s)if(ps(l)){const c=o(l[r]);c.length&&a.push(Object.assign({},l,{[r]:c}))}else{if(rm(l))continue;e(i,l)&&a.push(l)}return a}return o(n)}function P5(n,e,i){const r=new Map;return n.forEach(o=>{ps(o)?o[i].forEach(s=>{r.set(s[e],s)}):r.set(o[e],o)}),r}var F5={};const V5=Object.assign(Object.assign({},Tt.props),{to:Yn.propTo,bordered:{type:Boolean,default:void 0},clearable:Boolean,clearFilterAfterSelect:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},defaultValue:{type:[String,Number,Array],default:null},keyboard:{type:Boolean,default:!0},value:[String,Number,Array],placeholder:String,menuProps:Object,multiple:Boolean,size:String,menuSize:{type:String},filterable:Boolean,disabled:{type:Boolean,default:void 0},remote:Boolean,loading:Boolean,filter:Function,placement:{type:String,default:"bottom-start"},widthMode:{type:String,default:"trigger"},tag:Boolean,onCreate:Function,fallbackOption:{type:[Function,Boolean],default:void 0},show:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:!0},maxTagCount:[Number,String],ellipsisTagPopoverProps:Object,consistentMenuWidth:{type:Boolean,default:!0},virtualScroll:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},childrenField:{type:String,default:"children"},renderLabel:Function,renderOption:Function,renderTag:Function,"onUpdate:value":[Function,Array],inputProps:Object,nodeProps:Function,ignoreComposition:{type:Boolean,default:!0},showOnFocus:Boolean,onUpdateValue:[Function,Array],onBlur:[Function,Array],onClear:[Function,Array],onFocus:[Function,Array],onScroll:[Function,Array],onSearch:[Function,Array],onUpdateShow:[Function,Array],"onUpdate:show":[Function,Array],displayDirective:{type:String,default:"show"},resetMenuOnOptionsChange:{type:Boolean,default:!0},status:String,showCheckmark:{type:Boolean,default:!0},onChange:[Function,Array],items:Array}),M5=t.defineComponent({name:"Select",props:V5,slots:Object,setup(n){F5.NODE_ENV!=="production"&&t.watchEffect(()=>{n.items!==void 0&&gi("select","`items` is deprecated, please use `options` instead."),n.onChange!==void 0&&gi("select","`on-change` is deprecated, please use `on-update:value` instead.")});const{mergedClsPrefixRef:e,mergedBorderedRef:i,namespaceRef:r,inlineThemeDisabled:o}=Oi(n),s=Tt("Select","-select",$5,T5,n,e),a=t.ref(n.defaultValue),l=t.toRef(n,"value"),c=La(l,a),d=t.ref(!1),u=t.ref(""),f=Rf(n,["items","options"]),h=t.ref([]),p=t.ref([]),m=t.computed(()=>p.value.concat(h.value).concat(f.value)),g=t.computed(()=>{const{filter:H}=n;if(H)return H;const{labelField:Z,valueField:ae}=n;return(me,ye)=>{if(!ye)return!1;const Ce=ye[Z];if(typeof Ce=="string")return hl(me,Ce);const Be=ye[ae];return typeof Be=="string"?hl(me,Be):typeof Be=="number"?hl(me,String(Be)):!1}}),b=t.computed(()=>{if(n.remote)return f.value;{const{value:H}=m,{value:Z}=u;return!Z.length||!n.filterable?H:R5(H,g.value,Z,n.childrenField)}}),y=t.computed(()=>{const{valueField:H,childrenField:Z}=n,ae=E5(H,Z);return av(b.value,ae)}),_=t.computed(()=>P5(m.value,n.valueField,n.childrenField)),k=t.ref(!1),x=La(t.toRef(n,"show"),k),v=t.ref(null),B=t.ref(null),w=t.ref(null),{localeRef:T}=zh("Select"),C=t.computed(()=>{var H;return(H=n.placeholder)!==null&&H!==void 0?H:T.value.placeholder}),$=[],E=t.ref(new Map),I=t.computed(()=>{const{fallbackOption:H}=n;if(H===void 0){const{labelField:Z,valueField:ae}=n;return me=>({[Z]:String(me),[ae]:me})}return H===!1?!1:Z=>Object.assign(H(Z),{value:Z})});function R(H){const Z=n.remote,{value:ae}=E,{value:me}=_,{value:ye}=I,Ce=[];return H.forEach(Be=>{if(me.has(Be))Ce.push(me.get(Be));else if(Z&&ae.has(Be))Ce.push(ae.get(Be));else if(ye){const $e=ye(Be);$e&&Ce.push($e)}}),Ce}const O=t.computed(()=>{if(n.multiple){const{value:H}=c;return Array.isArray(H)?R(H):[]}return null}),U=t.computed(()=>{const{value:H}=c;return!n.multiple&&!Array.isArray(H)?H===null?null:R([H])[0]||null:null}),Q=DS(n),{mergedSizeRef:G,mergedDisabledRef:W,mergedStatusRef:D}=Q;function L(H,Z){const{onChange:ae,"onUpdate:value":me,onUpdateValue:ye}=n,{nTriggerFormChange:Ce,nTriggerFormInput:Be}=Q;ae&&Nt(ae,H,Z),ye&&Nt(ye,H,Z),me&&Nt(me,H,Z),a.value=H,Ce(),Be()}function z(H){const{onBlur:Z}=n,{nTriggerFormBlur:ae}=Q;Z&&Nt(Z,H),ae()}function P(){const{onClear:H}=n;H&&Nt(H)}function q(H){const{onFocus:Z,showOnFocus:ae}=n,{nTriggerFormFocus:me}=Q;Z&&Nt(Z,H),me(),ae&&A()}function K(H){const{onSearch:Z}=n;Z&&Nt(Z,H)}function J(H){const{onScroll:Z}=n;Z&&Nt(Z,H)}function Y(){var H;const{remote:Z,multiple:ae}=n;if(Z){const{value:me}=E;if(ae){const{valueField:ye}=n;(H=O.value)===null||H===void 0||H.forEach(Ce=>{me.set(Ce[ye],Ce)})}else{const ye=U.value;ye&&me.set(ye[n.valueField],ye)}}}function V(H){const{onUpdateShow:Z,"onUpdate:show":ae}=n;Z&&Nt(Z,H),ae&&Nt(ae,H),k.value=H}function A(){W.value||(V(!0),k.value=!0,n.filterable&&it())}function ie(){V(!1)}function ce(){u.value="",p.value=$}const pe=t.ref(!1);function at(){n.filterable&&(pe.value=!0)}function we(){n.filterable&&(pe.value=!1,x.value||ce())}function ke(){W.value||(x.value?n.filterable?it():ie():A())}function kt(H){var Z,ae;!((ae=(Z=w.value)===null||Z===void 0?void 0:Z.selfRef)===null||ae===void 0)&&ae.contains(H.relatedTarget)||(d.value=!1,z(H),ie())}function Ne(H){q(H),d.value=!0}function Jt(){d.value=!0}function wn(H){var Z;!((Z=v.value)===null||Z===void 0)&&Z.$el.contains(H.relatedTarget)||(d.value=!1,z(H),ie())}function Pt(){var H;(H=v.value)===null||H===void 0||H.focus(),ie()}function ni(H){var Z;x.value&&(!((Z=v.value)===null||Z===void 0)&&Z.$el.contains(zr(H))||ie())}function On(H){if(!Array.isArray(H))return[];if(I.value)return Array.from(H);{const{remote:Z}=n,{value:ae}=_;if(Z){const{value:me}=E;return H.filter(ye=>ae.has(ye)||me.has(ye))}else return H.filter(me=>ae.has(me))}}function cn(H){pt(H.rawNode)}function pt(H){if(W.value)return;const{tag:Z,remote:ae,clearFilterAfterSelect:me,valueField:ye}=n;if(Z&&!ae){const{value:Ce}=p,Be=Ce[0]||null;if(Be){const $e=h.value;$e.length?$e.push(Be):h.value=[Be],p.value=$}}if(ae&&E.value.set(H[ye],H),n.multiple){const Ce=On(c.value),Be=Ce.findIndex($e=>$e===H[ye]);if(~Be){if(Ce.splice(Be,1),Z&&!ae){const $e=se(H[ye]);~$e&&(h.value.splice($e,1),me&&(u.value=""))}}else Ce.push(H[ye]),me&&(u.value="");L(Ce,R(Ce))}else{if(Z&&!ae){const Ce=se(H[ye]);~Ce?h.value=[h.value[Ce]]:h.value=$}ii(),ie(),L(H[ye],H)}}function se(H){return h.value.findIndex(ae=>ae[n.valueField]===H)}function de(H){x.value||A();const{value:Z}=H.target;u.value=Z;const{tag:ae,remote:me}=n;if(K(Z),ae&&!me){if(!Z){p.value=$;return}const{onCreate:ye}=n,Ce=ye?ye(Z):{[n.labelField]:Z,[n.valueField]:Z},{valueField:Be,labelField:$e}=n;f.value.some(et=>et[Be]===Ce[Be]||et[$e]===Ce[$e])||h.value.some(et=>et[Be]===Ce[Be]||et[$e]===Ce[$e])?p.value=$:p.value=[Ce]}}function Re(H){H.stopPropagation();const{multiple:Z}=n;!Z&&n.filterable&&ie(),P(),Z?L([],[]):L(null,null)}function qe(H){!Or(H,"action")&&!Or(H,"empty")&&!Or(H,"header")&&H.preventDefault()}function dn(H){J(H)}function Kt(H){var Z,ae,me,ye,Ce;if(!n.keyboard){H.preventDefault();return}switch(H.key){case" ":if(n.filterable)break;H.preventDefault();case"Enter":if(!(!((Z=v.value)===null||Z===void 0)&&Z.isComposing)){if(x.value){const Be=(ae=w.value)===null||ae===void 0?void 0:ae.getPendingTmNode();Be?cn(Be):n.filterable||(ie(),ii())}else if(A(),n.tag&&pe.value){const Be=p.value[0];if(Be){const $e=Be[n.valueField],{value:et}=c;n.multiple&&Array.isArray(et)&&et.includes($e)||pt(Be)}}}H.preventDefault();break;case"ArrowUp":if(H.preventDefault(),n.loading)return;x.value&&((me=w.value)===null||me===void 0||me.prev());break;case"ArrowDown":if(H.preventDefault(),n.loading)return;x.value?(ye=w.value)===null||ye===void 0||ye.next():A();break;case"Escape":x.value&&(IS(H),ie()),(Ce=v.value)===null||Ce===void 0||Ce.focus();break}}function ii(){var H;(H=v.value)===null||H===void 0||H.focus()}function it(){var H;(H=v.value)===null||H===void 0||H.focusInput()}function en(){var H;x.value&&((H=B.value)===null||H===void 0||H.syncPosition())}Y(),t.watch(t.toRef(n,"options"),Y);const br={focus:()=>{var H;(H=v.value)===null||H===void 0||H.focus()},focusInput:()=>{var H;(H=v.value)===null||H===void 0||H.focusInput()},blur:()=>{var H;(H=v.value)===null||H===void 0||H.blur()},blurInput:()=>{var H;(H=v.value)===null||H===void 0||H.blurInput()}},xn=t.computed(()=>{const{self:{menuBoxShadow:H}}=s.value;return{"--n-menu-box-shadow":H}}),ri=o?zi("select",void 0,xn,n):void 0;return Object.assign(Object.assign({},br),{mergedStatus:D,mergedClsPrefix:e,mergedBordered:i,namespace:r,treeMate:y,isMounted:ns(),triggerRef:v,menuRef:w,pattern:u,uncontrolledShow:k,mergedShow:x,adjustedTo:Yn(n),uncontrolledValue:a,mergedValue:c,followerRef:B,localizedPlaceholder:C,selectedOption:U,selectedOptions:O,mergedSize:G,mergedDisabled:W,focused:d,activeWithoutMenuOpen:pe,inlineThemeDisabled:o,onTriggerInputFocus:at,onTriggerInputBlur:we,handleTriggerOrMenuResize:en,handleMenuFocus:Jt,handleMenuBlur:wn,handleMenuTabOut:Pt,handleTriggerClick:ke,handleToggle:cn,handleDeleteOption:pt,handlePatternInput:de,handleClear:Re,handleTriggerBlur:kt,handleTriggerFocus:Ne,handleKeydown:Kt,handleMenuAfterLeave:ce,handleMenuClickOutside:ni,handleMenuScroll:dn,handleMenuKeydown:Kt,handleMenuMousedown:qe,mergedTheme:s,cssVars:o?void 0:xn,themeClass:ri==null?void 0:ri.themeClass,onRender:ri==null?void 0:ri.onRender})},render(){return t.h("div",{class:`${this.mergedClsPrefix}-select`},t.h(Mf,null,{default:()=>[t.h(If,null,{default:()=>t.h(B5,{ref:"triggerRef",inlineThemeDisabled:this.inlineThemeDisabled,status:this.mergedStatus,inputProps:this.inputProps,clsPrefix:this.mergedClsPrefix,showArrow:this.showArrow,maxTagCount:this.maxTagCount,ellipsisTagPopoverProps:this.ellipsisTagPopoverProps,bordered:this.mergedBordered,active:this.activeWithoutMenuOpen||this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,renderTag:this.renderTag,renderLabel:this.renderLabel,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,labelField:this.labelField,valueField:this.valueField,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,loading:this.loading,focused:this.focused,onClick:this.handleTriggerClick,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onClear:this.handleClear,onBlur:this.handleTriggerBlur,onFocus:this.handleTriggerFocus,onKeydown:this.handleKeydown,onPatternBlur:this.onTriggerInputBlur,onPatternFocus:this.onTriggerInputFocus,onResize:this.handleTriggerOrMenuResize,ignoreComposition:this.ignoreComposition},{arrow:()=>{var n,e;return[(e=(n=this.$slots).arrow)===null||e===void 0?void 0:e.call(n)]}})}),t.h(Zf,{ref:"followerRef",show:this.mergedShow,to:this.adjustedTo,teleportDisabled:this.adjustedTo===Yn.tdkey,containerClass:this.namespace,width:this.consistentMenuWidth?"target":void 0,minWidth:"target",placement:this.placement},{default:()=>t.h(t.Transition,{name:"fade-in-scale-up-transition",appear:this.isMounted,onAfterLeave:this.handleMenuAfterLeave},{default:()=>{var n,e,i;return this.mergedShow||this.displayDirective==="show"?((n=this.onRender)===null||n===void 0||n.call(this),t.withDirectives(t.h(t5,Object.assign({},this.menuProps,{ref:"menuRef",onResize:this.handleTriggerOrMenuResize,inlineThemeDisabled:this.inlineThemeDisabled,virtualScroll:this.consistentMenuWidth&&this.virtualScroll,class:[`${this.mergedClsPrefix}-select-menu`,this.themeClass,(e=this.menuProps)===null||e===void 0?void 0:e.class],clsPrefix:this.mergedClsPrefix,focusable:!0,labelField:this.labelField,valueField:this.valueField,autoPending:!0,nodeProps:this.nodeProps,theme:this.mergedTheme.peers.InternalSelectMenu,themeOverrides:this.mergedTheme.peerOverrides.InternalSelectMenu,treeMate:this.treeMate,multiple:this.multiple,size:this.menuSize,renderOption:this.renderOption,renderLabel:this.renderLabel,value:this.mergedValue,style:[(i=this.menuProps)===null||i===void 0?void 0:i.style,this.cssVars],onToggle:this.handleToggle,onScroll:this.handleMenuScroll,onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onTabOut:this.handleMenuTabOut,onMousedown:this.handleMenuMousedown,show:this.mergedShow,showCheckmark:this.showCheckmark,resetMenuOnOptionsChange:this.resetMenuOnOptionsChange}),{empty:()=>{var r,o;return[(o=(r=this.$slots).empty)===null||o===void 0?void 0:o.call(r)]},header:()=>{var r,o;return[(o=(r=this.$slots).header)===null||o===void 0?void 0:o.call(r)]},action:()=>{var r,o;return[(o=(r=this.$slots).action)===null||o===void 0?void 0:o.call(r)]}}),this.displayDirective==="show"?[[t.vShow,this.mergedShow],[ts,this.handleMenuClickOutside,void 0,{capture:!0}]]:[[ts,this.handleMenuClickOutside,void 0,{capture:!0}]])):null}})})]}))}}),I5={},om=t.defineComponent({...I5,__name:"searchable-reference-select",props:{searchDataHandler:{},optionsListConverter:{},renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=t.computed(()=>s.value?r.value.map(_=>_.id):r.value?r.value.id:null),l=t.ref(s.value?r.optionsListConverter(r.value):r.value?r.optionsListConverter([r.value]):[]),c=t.computed(()=>l.value.map(_=>({..._,class:r.wrapContent?`${_.class} consistent-menu-width`:_.class}))),d=t.ref(!1),u=t.useTemplateRef("select-component"),f=_=>{_.length<r.minTermLength||(d.value=!0,r.searchDataHandler(_,d).then(k=>{if(M.isEmpty(k))return;const x=s.value?r.value:r.value?[r.value]:[],v=k.filter(B=>!x.some(w=>w.id===B.id));l.value=r.optionsListConverter([...x,...v])}).finally(()=>{d.value=!1}))};let h="";const p=M.debounce(()=>f(h),800),m=_=>{h=_,p()},g=_=>{var k;if(M.isArray(_)){const x=_.length>0?_.map(v=>{var B;return t.toRaw((B=l.value.find(w=>w.value===v))==null?void 0:B.item)}):[];o("update:value",x)}else if(_>0){const x=t.toRaw((k=l.value.find(v=>v.value===_))==null?void 0:k.item);o("update:value",x)}else o("update:value",null)};return e({focus:()=>{var _;return(_=u.value)==null?void 0:_.focusInput()},blur:()=>{var _;return(_=u.value)==null?void 0:_.blurInput()}}),(_,k)=>(t.openBlock(),t.createBlock(t.unref(M5),{ref:"select-component","clear-filter-after-select":!0,clearable:n.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled,filterable:!0,loading:d.value,multiple:s.value,options:c.value,placeholder:n.placeholder,remote:!0,value:a.value,"render-label":n.renderLabel,"render-tag":n.renderTag,onSearch:m,"onUpdate:value":g},null,8,["clearable","consistent-menu-width","disabled","loading","multiple","options","placeholder","value","render-label","render-tag"]))}}),A5={},sm=t.defineComponent({...A5,__name:"searchable-product-select",props:{renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""},searchType:{}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useTemplateRef("select-component"),a=async f=>r.searchType==="categories"?j.HttpRequester.getInstance(j.ProductCategoryDataProvider).publicSimpleSearch(f):r.searchType==="products"?j.HttpRequester.getInstance(j.ProductDataProvider).publicSimpleSearch(f):new Promise(h=>{h([])}),l=f=>r.searchType==="categories"?_t.convertReferencesToSelectOptionsList(f,!0,!1,!1,h=>h!=null&&h.isNewRec()?"-":h.name):r.searchType==="products"?_t.convertReferencesToSelectOptionsList(f,!0,!1,!1,h=>h!=null&&h.isNewRec()?"-":`[${h.code}] ${h.name}`):[],c=(f,h)=>{if(r.renderLabel)return r.renderLabel(f,h);if(r.searchType==="products"){const p=f.item;return t.h("div",{},[t.h("span",{class:"text-sc-grey mr-2.5"},p.code),t.h("span",{},[p.name])])}if(r.searchType==="categories"){const p=f.item;return t.h("div",{},[p.name])}};return e({focus:()=>{var f;return(f=s.value)==null?void 0:f.focus()},blur:()=>{var f;return(f=s.value)==null?void 0:f.blur()}}),(f,h)=>(t.openBlock(),t.createBlock(om,{ref:"select-component",value:n.value,clearable:n.clearable,disabled:n.disabled,placeholder:n.placeholder,"search-data-handler":a,"options-list-converter":l,"consistent-menu-width":n.consistentMenuWidth,"wrap-content":n.wrapContent,"min-term-length":n.minTermLength,"render-label":c,"render-tag":n.renderTag,"onUpdate:value":h[0]||(h[0]=p=>o("update:value",p))},null,8,["value","clearable","disabled","placeholder","consistent-menu-width","wrap-content","min-term-length","render-tag"]))}}),O5={class:"col-span-2 flex flex-row gap-2.5"},z5={class:"flex-1"},D5={class:"text-sc-grey"},L5={class:"ml-2.5"},H5={key:0,class:"flex-none"},W5={},j5=t.defineComponent({...W5,__name:"products-list",props:{value:{},searchType:{},minTermLength:{default:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},disabled:{type:Boolean}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(null),s=()=>structuredClone(t.toRaw(i.value)),a=t.ref(s()),l=()=>{r("update:value",a.value.map(f=>t.toRaw(f)))},c=f=>{f&&(a.value=[...a.value.map(h=>t.toRaw(h)),...(M.isArray(f)?f:[f]).filter(h=>!a.value.some(p=>p.id===h.id))],t.nextTick(()=>{o.value=null}),l())},d=f=>{f&&(a.value=a.value.map(h=>h.id===f.id?f:t.toRaw(h)),l())},u=f=>{a.value=a.value.filter(h=>h.id!==f.id),l()};return t.watch(()=>i.value,()=>{a.value=s()}),(f,h)=>{const p=F.NListItem,m=_C,g=F.NButton,b=F.NList;return t.openBlock(),t.createBlock(b,{"show-divider":!1,hoverable:!0},{header:t.withCtx(()=>[t.renderSlot(f.$slots,"header")]),footer:t.withCtx(()=>[t.createVNode(sm,{value:o.value,"onUpdate:value":[h[0]||(h[0]=y=>o.value=y),c],clearable:!0,disabled:n.disabled,"min-term-length":n.minTermLength,"search-type":n.searchType,placeholder:"Введите название"},null,8,["value","disabled","min-term-length","search-type"])]),default:t.withCtx(()=>[a.value.length===0?(t.openBlock(),t.createBlock(p,{key:0,class:"text-center text-sm text-gray-600"},{default:t.withCtx(()=>[...h[1]||(h[1]=[t.createTextVNode(" --- Список пуст --- ",-1)])]),_:1})):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,y=>(t.openBlock(),t.createBlock(p,{key:y.id},{suffix:t.withCtx(()=>[t.createVNode(g,{disabled:n.disabled,quaternary:"",type:"error",onClick:_=>u(y)},{default:t.withCtx(()=>[t.createVNode(m)]),_:1},8,["disabled","onClick"])]),default:t.withCtx(()=>[t.createElementVNode("div",O5,[t.createElementVNode("span",z5,[t.createElementVNode("span",D5,t.toDisplayString(y.code),1),t.createElementVNode("span",L5,t.toDisplayString(y.name),1)]),f.$slots["item-extra"]?(t.openBlock(),t.createElementBlock("div",H5,[t.renderSlot(f.$slots,"item-extra",{item:y,updateItemCallback:d})])):t.createCommentVNode("",!0)])]),_:2},1024))),128))]),_:3})}}}),q5={class:"flex flex-col"},X5={class:"flex flex-col gap-1.5 text-base text-nowrap"},Y5={class:"font-medium"},U5={class:"flex flex-col text-sc-dark-grey"},K5={key:0},G5={class:"font-medium"},Z5={class:"font-medium"},Q5={class:"font-medium"},J5={class:"font-medium"},e3={class:"font-medium"},t3={class:"font-medium"},n3={class:"font-medium"},i3={class:"font-medium"},r3={class:"font-medium"},o3={class:"font-medium"},s3={class:"flex flex-col gap-1.5 text-base text-nowrap"},a3={class:"font-medium"},l3={class:"flex flex-col text-sc-dark-grey"},c3={class:"font-medium"},d3={class:"font-medium"},u3={class:"flex flex-col gap-1.5 text-base text-nowrap"},f3={class:"font-medium"},h3={class:"text-sc-dark-grey"},m3={class:"font-medium"},p3={key:1,class:"text-base font-medium text-nowrap"},g3={},ml=t.defineComponent({...g3,__name:"order-item-params",props:{item:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},updateQuantityOnInput:{type:Boolean,default:!0}},setup(n){const e=[j.ConfiguratorsEnum.Kozyrek,j.ConfiguratorsEnum.Mosquitto,j.ConfiguratorsEnum.Strip,j.ConfiguratorsEnum.MetalForDoors,j.ConfiguratorsEnum.Sandwich,j.ConfiguratorsEnum.SandwichM2],i=n,r=t.ref(!1),o=t.computed(()=>i.item),s=t.computed(()=>{var p,m;return((p=i.item.product.unit)==null?void 0:p.isLinear)&&((m=i.item.product.properties)==null?void 0:m.isLengthConfigurator)}),a=t.computed(()=>j.UnitsHelper.getProductLengthMultiplicity(i.item.product)),l=t.computed(()=>j.UnitsHelper.getProductMultiplicity(i.item.product)),c=t.computed(()=>l.value>1),d=t.ref({quantity:i.item.quantity});t.watch(()=>i.item,p=>{d.value={quantity:p.quantity}});const u=p=>{var m;p!==null&&(d.value.quantity=p,(m=i.eventEmitter)==null||m.emit("order-item:edit-quantity",{item:o.value,quantity:p,loaderRef:r}))},f=()=>{var p;(p=i.eventEmitter)==null||p.emit("order-item:open-configurator",{item:o.value})},h=()=>{var p;(p=i.eventEmitter)==null||p.emit("order-item:edit",{item:o.value})};return(p,m)=>{const g=F.NInputNumber;return t.openBlock(),t.createElementBlock("div",q5,[n.item.configurator&&n.item.configuratorParams&&e.includes(n.item.configurator)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",X5,[t.createElementVNode("span",null,[m[1]||(m[1]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",Y5,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("div",U5,[n.item.configurator===t.unref(j.ConfiguratorsEnum).Kozyrek?(t.openBlock(),t.createElementBlock("span",K5,[m[2]||(m[2]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",G5,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])):t.createCommentVNode("",!0),n.item.configurator===t.unref(j.ConfiguratorsEnum).Mosquitto?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("span",null,[m[3]||(m[3]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",Z5,t.toDisplayString(Math.round(n.item.width*1e3))+" мм.",1)]),t.createElementVNode("span",null,[m[4]||(m[4]=t.createTextVNode(" Высота: ",-1)),t.createElementVNode("span",Q5,t.toDisplayString(Math.round(n.item.height*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(j.ConfiguratorsEnum).Strip?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.item.configuratorParams.linesWidths,(b,y)=>(t.openBlock(),t.createElementBlock("span",{key:y},[t.createTextVNode(" Полоса №"+t.toDisplayString(Number(y)+1)+": ",1),t.createElementVNode("span",J5,t.toDisplayString(b)+" мм.",1)]))),128)),t.createElementVNode("span",null,[m[5]||(m[5]=t.createTextVNode(" Метраж: ",-1)),t.createElementVNode("span",e3,t.toDisplayString(n.item.length)+" м.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(j.ConfiguratorsEnum).MetalForDoors?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("span",null,[m[6]||(m[6]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",t3,t.toDisplayString(n.item.width)+" мм.",1)]),t.createElementVNode("span",null,[m[7]||(m[7]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",n3,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(j.ConfiguratorsEnum).Sandwich?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:4},t.renderList(n.item.configuratorParams.items??[],(b,y)=>(t.openBlock(),t.createElementBlock("span",{key:y},[t.createTextVNode(" Изделие №"+t.toDisplayString(Number(y)+1)+": ",1),t.createElementVNode("span",i3,t.toDisplayString(b.width)+"×"+t.toDisplayString(b.length)+" мм, "+t.toDisplayString(b.count)+" шт.",1)]))),128)):t.createCommentVNode("",!0),n.item.configurator===t.unref(j.ConfiguratorsEnum).SandwichM2?(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[t.createElementVNode("span",null,[m[8]||(m[8]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",r3,t.toDisplayString(Math.round(n.item.width*1e3))+" мм.",1)]),t.createElementVNode("span",null,[m[9]||(m[9]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",o3,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0)])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(f,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):s.value&&a.value>0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",s3,[t.createElementVNode("span",null,[m[10]||(m[10]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",a3,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("div",l3,[t.createElementVNode("span",null,[m[11]||(m[11]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",c3,t.toDisplayString(a.value)+" "+t.toDisplayString(n.item.product.unit.name),1)]),t.createElementVNode("span",null,[m[12]||(m[12]=t.createTextVNode(" Всего: ",-1)),t.createElementVNode("span",d3,t.toDisplayString(n.item.quantity*a.value)+" "+t.toDisplayString(n.item.product.unit.name),1)])])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(h,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):n.item.product.getIsMeasurable()?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",u3,[t.createElementVNode("span",null,[m[13]||(m[13]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",f3,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("span",h3,[m[14]||(m[14]=t.createTextVNode(" Метраж: ",-1)),t.createElementVNode("span",m3,t.toDisplayString(n.item.length??n.item.width)+" "+t.toDisplayString(n.item.product.unit.name),1)])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(h,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[n.allowEdit?(t.openBlock(),t.createBlock(g,{key:0,value:d.value.quantity,parse:t.unref(ct),min:l.value,step:l.value,"show-button":c.value,"button-placement":"both","update-value-on-input":n.updateQuantityOnInput,disabled:!!r.value,loading:!!r.value,placeholder:"Кол-во",size:"small",class:"min-w-16 grow",onKeydown:m[0]||(m[0]=b=>t.unref(ao)(b,".",!1)),onFocus:t.unref(Le),"onUpdate:value":u},{suffix:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.item.product.unit.name),1)]),_:1},8,["value","parse","min","step","show-button","update-value-on-input","disabled","loading","onFocus"])):(t.openBlock(),t.createElementBlock("span",p3,t.toDisplayString(n.item.quantity)+" "+t.toDisplayString(n.item.product.unit.name),1))],64))])}}}),y3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function b3(n,e){return t.openBlock(),t.createElementBlock("svg",y3,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M13 4a1 1 0 0 1 1 1h4a1 1 0 0 1 .783.378l.074.108l3 5l.055.103l.04.107l.029.109l.016.11L22 11v6a1 1 0 0 1-1 1h-1.171a3.001 3.001 0 0 1-5.658 0H9.829a3.001 3.001 0 0 1-5.658 0H3a1 1 0 0 1-1-1V6a2 2 0 0 1 2-2zM7 16a1 1 0 1 0 0 2a1 1 0 0 0 0-2m10 0a1 1 0 1 0 0 2a1 1 0 0 0 0-2m.434-9H14v3h5.234z"},null,-1)])])}const _3=t.markRaw({name:"tabler-truck-filled",render:b3}),w3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function x3(n,e){return t.openBlock(),t.createElementBlock("svg",w3,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M5 17a2 2 0 1 0 4 0a2 2 0 1 0-4 0m10 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"}),t.createElementVNode("path",{d:"M5 17H3v-4M2 5h11v12m-4 0h6m4 0h2v-6h-8m0-5h5l3 5M3 9h4"})],-1)])])}const k3=t.markRaw({name:"tabler-truck-delivery",render:x3}),C3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function v3(n,e){return t.openBlock(),t.createElementBlock("svg",C3,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M2 3h1a2 2 0 0 1 2 2v10a2 2 0 0 0 2 2h15"}),t.createElementVNode("path",{d:"M9 9a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-4a3 3 0 0 1-3-3zM7 19a2 2 0 1 0 4 0a2 2 0 1 0-4 0m9 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"})],-1)])])}const S3=t.markRaw({name:"tabler-truck-loading",render:v3}),B3={class:"flex flex-col gap-1"},N3={key:0,class:"flex flex-row gap-1 text-sm text-sc-grey"},T3={key:1,class:"text-base"},$3={class:"text-sc-dark-grey mr-1.5"},E3={key:0},R3={key:1},P3={},gs=t.defineComponent({...P3,__name:"order-delivery-label",props:{delivery:{},showType:{type:Boolean,default:!0},showDetails:{type:Boolean,default:!0}},setup(n){const e=t.computed(()=>{var s;return(s=j.useReferencesStore().deliveryTypeReference)==null?void 0:s.find(a=>a.id===o.delivery.type)}),i=t.computed(()=>xe.format(o.delivery.date,"dd.MM.yyyy")),r=t.computed(()=>{var s;return(s=o.delivery.address)!=null&&s.address?si.getFormatEntityName({name:o.delivery.address.address,deletedAt:o.delivery.address.deletedAt}):""}),o=n;return(s,a)=>{var u,f,h,p,m,g,b,y;const l=S3,c=k3,d=_3;return t.openBlock(),t.createElementBlock("div",B3,[n.showType?(t.openBlock(),t.createElementBlock("span",N3,[((u=e.value)==null?void 0:u.slug)==="self_delivery"?(t.openBlock(),t.createBlock(l,{key:0})):t.createCommentVNode("",!0),((f=e.value)==null?void 0:f.slug)==="delivery"?(t.openBlock(),t.createBlock(c,{key:1})):t.createCommentVNode("",!0),((h=e.value)==null?void 0:h.slug)==="transport_company_delivery"?(t.openBlock(),t.createBlock(d,{key:2})):t.createCommentVNode("",!0),t.createElementVNode("span",null,t.toDisplayString((p=e.value)==null?void 0:p.name),1)])):t.createCommentVNode("",!0),n.showDetails?(t.openBlock(),t.createElementBlock("span",T3,[t.createElementVNode("span",$3,t.toDisplayString(i.value),1),(g=(m=n.delivery)==null?void 0:m.address)!=null&&g.address?(t.openBlock(),t.createElementBlock("span",E3,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0),(y=(b=n.delivery)==null?void 0:b.warehouse)!=null&&y.address?(t.openBlock(),t.createElementBlock("span",R3," со склада "+t.toDisplayString(n.delivery.warehouse.address),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])}}}),F3={class:"flex flex-col gap-2.5"},V3={class:"text-base"},M3=["href"],I3={key:1,class:"text-sc-grey"},A3={},am=t.defineComponent({...A3,__name:"order-common-info",props:{order:{},eventEmitter:{},allowEdit:{type:Boolean},fields:{},showAttachedUserColumn:{type:Boolean},orderContextButtonsConfig:{type:Function},onOrderContextSelect:{type:Function},orderUrl:{},highlightSettings:{}},setup(n){const e=n,i=t.computed(()=>e.fields.includes(Me.Id)?e.order.id:void 0),r=t.computed(()=>{var f,h;return e.fields.includes(Me.Status)?(h=(f=j.useReferencesStore().orderStatusReference)==null?void 0:f.find(p=>{var m;return p.id===(((m=e.order.status)==null?void 0:m.id)??-1)}))==null?void 0:h.name:void 0}),o=t.computed(()=>{var f;return wi((f=e.order.status)==null?void 0:f.slug)}),s=t.computed(()=>{var h,p;const f=(h=e.order.status)==null?void 0:h.slug;return!!f&&(((p=e.highlightSettings)==null?void 0:p.statuses.includes(f))??!1)}),a=t.computed(()=>Ns(e.order).filter(f=>[rt.OnOrder,rt.NotInStock].includes(f))),l=f=>{var h;return((h=e.highlightSettings)==null?void 0:h.markers.includes(f))??!1},c=t.computed(()=>e.fields.includes(Me.CreatedAt)),d=t.computed(()=>e.fields.includes(Me.ClientInfo)||e.fields.includes(Me.ClientInfoShort)?e.order.client:void 0),u=t.computed(()=>e.fields.includes(Me.DeliveryInfo)?e.order.delivery:void 0);return(f,h)=>(t.openBlock(),t.createElementBlock("div",F3,[t.createElementVNode("span",V3,[i.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:n.orderUrl.replace(":id",n.order.id.toString()),target:"_blank",class:"text-sc-dark-grey"}," #"+t.toDisplayString(i.value),9,M3)):t.createCommentVNode("",!0),c.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[h[0]||(h[0]=t.createTextVNode(" от ",-1)),t.createVNode(Ko,{date:n.order.createdAt,"is-time-secondary":!0},null,8,["date"])],64)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[h[1]||(h[1]=t.createTextVNode(" - ",-1)),s.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"font-medium",style:t.normalizeStyle({color:o.value.color})},t.toDisplayString(r.value),5)):(t.openBlock(),t.createElementBlock("span",I3,t.toDisplayString(r.value),1))],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,p=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:p},[h[2]||(h[2]=t.createTextVNode(" - ",-1)),t.createElementVNode("span",{class:t.normalizeClass({"font-medium":l(p),"text-sc-dark-grey":!l(p)}),style:t.normalizeStyle(l(p)?{color:t.unref(Sr)(p).color}:void 0)},t.toDisplayString(t.unref(Bs)(p)),7)],64))),128))]),d.value?(t.openBlock(),t.createBlock(Ir,{key:0,client:d.value,class:"ml-3"},null,8,["client"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createBlock(gs,{key:1,delivery:u.value,class:"ml-3"},null,8,["delivery"])):t.createCommentVNode("",!0)]))}}),O3={},pl=t.defineComponent({...O3,__name:"order-payment",props:{payment:{}},setup(n){const e=n,i=t.computed(()=>{var r;return(r=j.useReferencesStore().paymentTypeReference)==null?void 0:r.find(o=>o.id===e.payment.type)});return(r,o)=>{var s;return t.openBlock(),t.createElementBlock("span",null,t.toDisplayString(((s=i.value)==null?void 0:s.name)??"-"),1)}}}),z3={},Jr=t.defineComponent({...z3,__name:"creator-user-type-tag",props:{userType:{default:void 0},prefixText:{default:"Добавлено"},variant:{default:"info"},changedFields:{default:void 0}},setup(n){const e=n,i={quantity:"количество",length:"длина"},r=t.computed(()=>e.variant==="danger"||e.changedFields?"bg-orange-500":"bg-sky-500"),o=t.computed(()=>{const s={[j.UserTypeEnum.Manager]:"менеджером",[j.UserTypeEnum.Operator]:"оператором",[j.UserTypeEnum.Client]:"клиентом",[j.UserTypeEnum.Admin]:"администратором"};if(e.changedFields){const l=e.changedFields.map(d=>i[d]??d).join(", ");return`Было изменено${e.userType?` ${s[e.userType]??""}`:""}: ${l}`}const a=e.userType?` ${s[e.userType]??""}`:"";return`${e.prefixText}${a}`.trim()});return(s,a)=>(t.openBlock(),t.createElementBlock("small",{class:t.normalizeClass(`inline-block py-[0.0625rem] px-1.5 text-xs font-bold text-center whitespace-nowrap rounded text-white no-underline opacity-100 ${r.value}`)},t.toDisplayString(o.value),3))}}),D3={class:"flex flex-row gap-1.5"},L3={class:"flex-none text-nowrap"},H3={class:"flex flex-1 flex-col gap-2.5"},W3={key:0,class:"text-sm"},j3={class:"text-gray-600"},q3={key:2,class:"flex items-start gap-1"},X3={class:"grid grid-flow-col grid-rows-2 gap-1 text-base"},Y3={key:0},U3={key:1},K3={},lm=t.defineComponent({...K3,__name:"order-product-info",props:{product:{},index:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},updateQuantityOnInput:{type:Boolean,default:!0}},setup(n){const e=t.inject(j.currentOrderInjectionKey,null),i=t.computed(()=>{if(e!=null)return t.toValue(e)??void 0});return(r,o)=>{var s;return t.openBlock(),t.createElementBlock("div",D3,[t.createElementVNode("span",L3,t.toDisplayString(n.index+1)+".",1),t.createElementVNode("div",H3,[t.createVNode(Tr,{product:n.product.product},null,8,["product"]),n.product.marker?(t.openBlock(),t.createElementBlock("span",W3,[o[0]||(o[0]=t.createTextVNode(" Маркировка: ",-1)),t.createElementVNode("span",j3,t.toDisplayString(n.product.marker),1)])):t.createCommentVNode("",!0),n.product.creator&&(!i.value||((s=i.value)==null?void 0:s.creator.guid)!==n.product.creator.guid)&&n.product.creator.type?(t.openBlock(),t.createBlock(Jr,{key:1,"user-type":n.product.creator.type,class:"self-start"},null,8,["user-type"])):t.createCommentVNode("",!0),n.allowEdit?(t.openBlock(),t.createElementBlock("div",q3,[t.createVNode(ml,{item:n.product,"event-emitter":n.eventEmitter,"allow-edit":n.allowEdit,"update-quantity-on-input":n.updateQuantityOnInput,class:"min-w-0 flex-1"},null,8,["item","event-emitter","allow-edit","update-quantity-on-input"]),t.renderSlot(r.$slots,"actions")])):t.createCommentVNode("",!0),t.createElementVNode("div",X3,[n.allowEdit?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o[1]||(o[1]=t.createElementVNode("span",null,"Кол-во",-1)),n.product.product.getIsMeasurable()?(t.openBlock(),t.createElementBlock("span",Y3,t.toDisplayString(`${n.product.length} ${n.product.product.unit.name} x ${n.product.quantity} шт.`),1)):(t.openBlock(),t.createElementBlock("span",U3,t.toDisplayString(`${n.product.quantity} ${n.product.product.unit.name}`),1))],64)),o[2]||(o[2]=t.createElementVNode("span",null,"Цена за ед.",-1)),t.createVNode(ai,{product:n.product,"cost-field-name":"costOneRub"},null,8,["product"]),o[3]||(o[3]=t.createElementVNode("span",null,"Сумма",-1)),t.createVNode(ai,{product:n.product,"cost-field-name":"cost"},null,8,["product"])])])])}}}),G3={class:"flex items-center gap-1.5"},Z3={key:0,class:"h-1.5 w-1.5 shrink-0 rounded-full bg-current"},Q3={key:0,class:"h-1.5 w-1.5 shrink-0 rounded-full bg-current"},J3={},cm=t.defineComponent({...J3,__name:"order-status-tag",props:{status:{},statusDetail:{default:null},variant:{default:"filled"},size:{default:"medium"},showDot:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>wi(e.status.slug)),r=t.computed(()=>Wl(e.status.slug)),o=t.computed(()=>e.statusDetail?`${e.status.name} (${e.statusDetail.name})`:e.status.name);return(s,a)=>{const l=F.NTag;return n.variant==="filled"?(t.openBlock(),t.createBlock(l,{key:0,color:r.value,bordered:!1,size:n.size,round:""},{default:t.withCtx(()=>[t.createElementVNode("span",G3,[n.showDot?(t.openBlock(),t.createElementBlock("span",Z3)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)])]),_:1},8,["color","size"])):(t.openBlock(),t.createElementBlock("span",{key:1,class:"inline-flex items-center gap-1.5 font-medium",style:t.normalizeStyle({color:i.value.color})},[n.showDot?(t.openBlock(),t.createElementBlock("span",Q3)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)],4))}}}),e4={},gl=t.defineComponent({...e4,__name:"order-color-swatch",props:{colors:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("span",{class:"inline-flex h-5 min-w-8 shrink-0 items-center justify-center rounded px-1.5 text-xs font-semibold leading-none",style:t.normalizeStyle({backgroundColor:n.colors.backgroundColor,color:n.colors.textOnBackgroundColor,border:`1px solid ${n.colors.color}`})}," Аа ",4))}}),t4={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function n4(n,e){return t.openBlock(),t.createElementBlock("svg",t4,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m112 112l20 320c.95 18.49 14.4 32 32 32h184c17.67 0 30.87-13.51 32-32l20-320"},null,-1),t.createElementVNode("path",{fill:"currentColor",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32",d:"M80 112h352"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 112V72h0a23.93 23.93 0 0 1 24-24h80a23.93 23.93 0 0 1 24 24h0v40m-64 64v224m-72-224l8 224m136-224l-8 224"},null,-1)])])}const i4=t.markRaw({name:"ion-trash-outline",render:n4}),r4={},o4=t.defineComponent({...r4,__name:"order-item-specification",props:{src:{}},setup(n){const e=t.useTemplateRef("image-reference");return(i,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("a",{class:"text-blue-500 hover:underline text-sm mt-1 block cursor-pointer",onClick:r[0]||(r[0]=o=>{var s;return(s=e.value)==null?void 0:s.showPreview()})}," Спецификация "),t.withDirectives(t.createVNode(t.unref(F.NImage),{ref:"image-reference",src:n.src,"previewed-img-props":{style:"max-width: 80vw; max-height: 80vh; object-fit: contain; border: 12px solid white;"}},null,8,["src"]),[[t.vShow,!1]])],64))}}),s4={class:"flex flex-col gap-0.5"},a4={class:"text-gray-600"},l4={},c4=t.defineComponent({...l4,__name:"order-item-name",props:{item:{}},setup(n){const e=n,i=t.inject(j.currentOrderInjectionKey,null),r=t.computed(()=>{if(i!=null)return t.toValue(i)??void 0}),o=t.computed(()=>!!e.item.isRemoved||!!e.item.replacementId),s=t.computed(()=>{var d;return"creator"in e.item&&!!((d=e.item.creator)!=null&&d.type)&&(!r.value||r.value.creator.guid!==e.item.creator.guid)}),a=t.computed(()=>"specificationImgUrl"in e.item?e.item.specificationImgUrl:void 0),l=t.computed(()=>"changedFields"in e.item?e.item.changedFields:[]),c=t.computed(()=>{var d,u;return"replacement"in e.item?(u=(d=e.item.replacement)==null?void 0:d.creator)==null?void 0:u.type:void 0});return(d,u)=>(t.openBlock(),t.createElementBlock("div",s4,[t.createElementVNode("div",{class:t.normalizeClass(o.value?"line-through opacity-50":"")},[t.createVNode(Tr,{product:n.item.product,"show-additional-sale-icon":n.item.isAdditionalSale??!1,"show-code":!1},null,8,["product","show-additional-sale-icon"])],2),n.item.marker?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(o.value?"line-through opacity-50":"")},[u[0]||(u[0]=t.createTextVNode(" Маркировка: ",-1)),t.createElementVNode("span",a4,t.toDisplayString(n.item.marker),1)],2)):t.createCommentVNode("",!0),a.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(o.value?"line-through opacity-50":"")},[t.createVNode(o4,{src:a.value},null,8,["src"])],2)):t.createCommentVNode("",!0),s.value&&!o.value?(t.openBlock(),t.createBlock(Jr,{key:2,"user-type":n.item.creator.type,class:"mt-1 self-start","prefix-text":"Добавлено"},null,8,["user-type"])):t.createCommentVNode("",!0),n.item.isRemoved&&!n.item.replacementId&&l.value.length===0?(t.openBlock(),t.createBlock(Jr,{key:3,class:"mt-1 self-start","prefix-text":"Удалено",variant:"danger"})):t.createCommentVNode("",!0),n.item.replacementId&&l.value.length>0?(t.openBlock(),t.createBlock(Jr,{key:4,"user-type":c.value,"changed-fields":l.value,class:"mt-1 self-start"},null,8,["user-type","changed-fields"])):t.createCommentVNode("",!0)]))}}),d4={key:0,class:"!mb-3 !mt-0 text-base font-semibold"},u4={class:"mb-1 flex flex-wrap items-baseline justify-between gap-2"},f4={class:"flex items-baseline gap-2"},h4={class:"text-base font-bold text-sc-dark-grey"},m4={key:0,class:"text-sm text-sc-grey"},p4={key:0,class:"text-sm text-sc-dark-grey"},g4={},y4=t.defineComponent({...g4,__name:"order-items-list",props:t.mergeModels({products:{},maxHeight:{default:void 0},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},title:{default:"Список позиций"},groups:{default:void 0},extraColumns:{default:void 0},isItemInactive:{type:Function,default:void 0},isItemSelectable:{type:Function,default:void 0},updateQuantityOnInput:{type:Boolean,default:!0}},{selectedRowKeys:{default:()=>[]},selectedRowKeysModifiers:{}}),emits:["update:selectedRowKeys"],setup(n){const e=n,i=t.useModel(n,"selectedRowKeys"),r=b=>M.sortBy(b,"ord"),o=t.computed(()=>r(e.products)),s=b=>e.isItemInactive?e.isItemInactive(b):!!b.isRemoved||!!b.replacementId,a=b=>e.isItemSelectable?e.isItemSelectable(b):!s(b),l=(b,y)=>{y?i.value.includes(b)||(i.value=[...i.value,b]):i.value=i.value.filter(_=>_!==b)},c=b=>e.selectable?{class:i.value.includes(b.id)?void 0:"opacity-60"}:{},d=(b,y)=>{const _=o.value,k=b.logicGroupId;if(!k)return 1;const x=_.at(y-1);if(y&&x&&x.logicGroupId===k)return 0;const v=_.slice(y),B=v.findIndex(w=>w.logicGroupId!==k);return B===-1?v.length:B},u=b=>s(b)?null:t.h(F.NButton,{quaternary:!0,size:"small",type:"error",onClick:()=>{var y;(y=e.eventEmitter)==null||y.emit("order-item:delete",{item:b})}},()=>t.h(i4)),f=t.ref(Xe.getDeviceTypeByResolution()),h=t.ref(window.innerWidth),p=()=>{const b=[{title:"№ п.п.",key:"id",resizable:!0,width:50,render:(_,k)=>t.h("span",{class:`text-base${s(_)?" line-through opacity-50":""}`},[k+1,"."])},{title:"Артикул",key:"codeNumber",resizable:!0,width:h.value>=1536?156:120,render:_=>t.h("span",{class:`text-base${s(_)?" line-through opacity-50":""}`},[_.product.code])},{title:"Наименование",key:"name",resizable:!0,render:_=>t.h(c4,{item:_})},{title:"Кол-во",key:"quantity",resizable:!0,width:180,rowSpan:d,render:_=>t.h(ml,{class:s(_)?"line-through opacity-50":"",item:_,eventEmitter:e.eventEmitter,allowEdit:e.allowEdit&&!s(_),updateQuantityOnInput:e.updateQuantityOnInput})},{title:"Цена за ед.",key:"costOneRub",resizable:!0,width:120,render:_=>t.h("div",{class:s(_)?"line-through opacity-50":""},[t.h(ai,{product:_,costFieldName:"costOne",showQuantityUnit:!0})])},{title:"Сумма",key:"cost",resizable:!0,width:120,render:_=>t.h("div",{class:s(_)?"line-through opacity-50":""},[t.h(ai,{product:_,costFieldName:"cost",showCurrency:!0})])},...e.extraColumns??[],...e.allowEdit?[{title:"",key:"delete",width:44,rowSpan:d,render:_=>u(_)}]:[]],y=e.selectable?[{key:"checkbox",title:"",className:"align-top",width:"32",cellProps:_=>({class:a(_)?"cursor-pointer":void 0,onClick:()=>{a(_)&&l(_.id,!i.value.includes(_.id))}}),render:_=>t.h(F.NCheckbox,{checked:i.value.includes(_.id),disabled:!a(_)})}]:[];switch(f.value){case je.phone:case je.tablet:return[...y,{title:"",key:"items",resizable:!0,render:(_,k)=>{const x=d(_,k)>0,v=e.allowEdit&&!s(_)&&x;return t.h(lm,{product:_,index:k,eventEmitter:e.eventEmitter,allowEdit:v,updateQuantityOnInput:e.updateQuantityOnInput},{actions:()=>u(_)})}}];case je.laptop:return[...y,...b];default:return[...y,...b]}},m=t.computed(()=>p()),g=()=>{f.value=Xe.getDeviceTypeByResolution(),h.value=window.innerWidth};return t.onMounted(()=>{g(),window.addEventListener("resize",g)}),t.onUnmounted(()=>{window.removeEventListener("resize",g)}),(b,y)=>{const _=F.NDataTable;return t.openBlock(),t.createElementBlock(t.Fragment,null,[n.title?(t.openBlock(),t.createElementBlock("h3",d4,t.toDisplayString(n.title),1)):t.createCommentVNode("",!0),n.groups?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.groups,k=>(t.openBlock(),t.createElementBlock("div",{key:k.name,class:"mb-6 last:mb-0"},[t.createElementVNode("div",u4,[t.createElementVNode("div",f4,[t.createElementVNode("span",h4,t.toDisplayString(k.name),1),k.description?(t.openBlock(),t.createElementBlock("span",m4,t.toDisplayString(k.description),1)):t.createCommentVNode("",!0)]),k.summary?(t.openBlock(),t.createElementBlock("span",p4,t.toDisplayString(k.summary),1)):t.createCommentVNode("",!0)]),t.createVNode(_,{columns:m.value,data:r(k.items),"row-key":x=>x.id,"row-props":c,"bottom-bordered":!1,bordered:!1,"max-height":n.maxHeight},null,8,["columns","data","row-key","max-height"])]))),128)):(t.openBlock(),t.createBlock(_,{key:2,columns:m.value,data:o.value,"row-key":k=>k.id,"row-props":c,"bottom-bordered":!1,bordered:!1,"max-height":n.maxHeight},null,8,["columns","data","row-key","max-height"]))],64)}}}),dm=fn(y4,[["__scopeId","data-v-e91ed0e6"]]),b4={key:0,class:"text-sc-dark-grey my-2 text-center"},_4={key:1,class:"text-sc-dark-grey my-2"},w4={},um=t.defineComponent({...w4,__name:"order-status-history",props:{order:{}},setup(n){const e=n,i=t.ref(!1),r=t.ref([]),o=a=>{const{uiDateWithTime:l}=j.useBaseConfigStateStore().config.dateFormats;return xe.format(a,l)},s=(a=!0)=>{a&&(i.value=!0),j.HttpRequester.getInstance(j.OrdersDataProvider).getOrderStatusHistory(e.order.id).then(l=>{r.value=l}).finally(()=>{a&&(i.value=!1)})};return t.watch(()=>e.order,()=>{s(!1)}),t.onMounted(()=>{s()}),(a,l)=>{const c=F.NSpin,d=F.NTimelineItem,u=F.NTimeline;return t.openBlock(),t.createElementBlock("div",null,[l[1]||(l[1]=t.createElementVNode("h3",{class:"!mb-3 !mt-0 text-base font-semibold"},"История статусов",-1)),i.value?(t.openBlock(),t.createElementBlock("div",b4,[t.createVNode(c,{size:"small",class:"mb-1 align-middle"}),l[0]||(l[0]=t.createElementVNode("span",{class:"ml-2"},"Загрузка истории ...",-1))])):r.value.length===0?(t.openBlock(),t.createElementBlock("div",_4," История статусов отсутствует. ")):(t.openBlock(),t.createBlock(u,{key:2},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(f,h)=>(t.openBlock(),t.createBlock(d,{key:h,color:t.unref(wi)(f.status.slug).color,time:o(f.createdAt),content:f.user.name},{header:t.withCtx(()=>[t.createVNode(cm,{status:f.status,"status-detail":f.statusDetail,variant:h===0?"filled":"text","show-dot":!1,size:"small"},null,8,["status","status-detail","variant"])]),_:2},1032,["color","time","content"]))),128))]),_:1}))])}}}),x4={class:"text-base"},k4={},yl=t.defineComponent({...k4,__name:"user-short-info",props:{user:{},showUserType:{type:Boolean,default:!0},extraInfoOnSecondLine:{type:Boolean,default:!0}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass({"flex flex-col":n.showUserType&&n.extraInfoOnSecondLine})},[t.createElementVNode("span",x4,t.toDisplayString(n.user.name),1),n.showUserType?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([{"ml-1":!n.extraInfoOnSecondLine},"text-sc-grey"])}," ["+t.toDisplayString(n.user.type)+"] ",3)):t.createCommentVNode("",!0)],2))}}),C4={class:"ml-4 grid grid-cols-3 gap-1.5 text-base"},v4={class:"col-span-2"},S4={class:"col-span-2"},B4={},fm=t.defineComponent({...B4,__name:"order-details",props:{order:{}},emits:["click:client-name"],setup(n,{emit:e}){const i=e;return(r,o)=>(t.openBlock(),t.createElementBlock("div",null,[o[11]||(o[11]=t.createElementVNode("h3",null,"Детали заказа",-1)),t.createElementVNode("div",C4,[n.order.creator.id!==n.order.client.id?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o[1]||(o[1]=t.createElementVNode("span",null,"Создал",-1)),t.createVNode(yl,{user:n.order.creator,class:"col-span-2"},null,8,["user"])],64)):t.createCommentVNode("",!0),o[10]||(o[10]=t.createElementVNode("span",null,"Клиент",-1)),t.createVNode(Ir,{client:n.order.client,class:"col-span-2","onClick:clientName":o[0]||(o[0]=s=>i("click:client-name",n.order.client,s))},null,8,["client"]),n.order.contragent?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o[2]||(o[2]=t.createElementVNode("span",null,"Контрагент",-1)),t.createVNode(Zu,{contragent:n.order.contragent,class:"col-span-2"},null,8,["contragent"])],64)):t.createCommentVNode("",!0),n.order.image?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[o[3]||(o[3]=t.createElementVNode("span",null,"Графический файл клиента",-1)),o[4]||(o[4]=t.createElementVNode("a",{class:"fancybox col-span-2",href:"{{ order.image }}"}," Посмотреть ",-1))],64)):t.createCommentVNode("",!0),n.order.barcode?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[o[5]||(o[5]=t.createElementVNode("span",null,"Штрих-код",-1)),t.createElementVNode("span",v4,t.toDisplayString(n.order.barcode),1)],64)):t.createCommentVNode("",!0),n.order.payment?(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[o[6]||(o[6]=t.createElementVNode("span",null,"Оплата",-1)),t.createVNode(pl,{payment:n.order.payment,class:"col-span-2"},null,8,["payment"])],64)):t.createCommentVNode("",!0),n.order.delivery?(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[o[7]||(o[7]=t.createElementVNode("span",null,"Доставка",-1)),t.createVNode(gs,{delivery:n.order.delivery,class:"col-span-2"},null,8,["delivery"])],64)):t.createCommentVNode("",!0),n.order.comment?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[o[8]||(o[8]=t.createElementVNode("span",null,"Комментарий",-1)),t.createElementVNode("span",S4,t.toDisplayString(n.order.comment),1)],64)):t.createCommentVNode("",!0),n.order.attachedUser?(t.openBlock(),t.createElementBlock(t.Fragment,{key:7},[o[9]||(o[9]=t.createElementVNode("span",null,"Закреплен за",-1)),t.createVNode(yl,{user:n.order.attachedUser,class:"col-span-2"},null,8,["user"])],64)):t.createCommentVNode("",!0)])]))}}),N4={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function T4(n,e){return t.openBlock(),t.createElementBlock("svg",N4,[...e[0]||(e[0]=[t.createElementVNode("rect",{width:"336",height:"336",x:"128",y:"128",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32",rx:"57",ry:"57"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m383.5 128l.5-24a56.16 56.16 0 0 0-56-56H112a64.19 64.19 0 0 0-64 64v216a56.16 56.16 0 0 0 56 56h24"},null,-1)])])}const $4=t.markRaw({name:"ion-copy-outline",render:T4}),E4={class:"flex flex-col items-stretch gap-1.5 text-base"},R4={},P4=t.defineComponent({...R4,__name:"order-external-links",props:{showErpLink:{type:Boolean,default:!1},order:{}},setup(n){const e=t.computed(()=>{var r,o;const i=(((r=n.order.invoices)==null?void 0:r.length)??0)>0;return n.showErpLink&&!!n.order.erpOrderUrl||i||!!((o=n.order.payment)!=null&&o.onlinePaymentLink)});return(i,r)=>{var a;const o=F.NButton,s=$4;return e.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[r[2]||(r[2]=t.createElementVNode("h3",{class:"!mb-3 !mt-0 text-base font-semibold"},"Внешние ссылки",-1)),t.createElementVNode("div",E4,[n.showErpLink&&n.order.erpOrderUrl?(t.openBlock(),t.createBlock(o,{key:0,tag:"a",href:n.order.erpOrderUrl,target:"_blank",block:"",class:"sc-external-link-button"},{default:t.withCtx(()=>[...r[0]||(r[0]=[t.createTextVNode(" Открыть в ERP ",-1)])]),_:1},8,["href"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.order.invoices??[],(l,c)=>(t.openBlock(),t.createBlock(o,{key:c,tag:"a",href:l,block:"",class:"sc-external-link-button"},{default:t.withCtx(()=>[t.createTextVNode(" Скачать счет №"+t.toDisplayString(c+1),1)]),_:2},1032,["href"]))),128)),(a=n.order.payment)!=null&&a.onlinePaymentLink?t.withDirectives((t.openBlock(),t.createBlock(o,{key:1,block:"",class:"sc-external-link-button",title:"Ссылка на оплату копируется в буфер обмена"},{default:t.withCtx(()=>[t.createVNode(s,{class:"mr-1.5"}),r[1]||(r[1]=t.createTextVNode(" Скопировать ссылку на оплату ",-1))]),_:1})),[[t.unref(zl),n.order.payment.onlinePaymentLink]]):t.createCommentVNode("",!0)])],64)):t.createCommentVNode("",!0)}}}),hm=fn(P4,[["__scopeId","data-v-6a3ae627"]]),F4={key:0},V4={class:"text-sc-dark-grey my-2 text-center"},M4={key:1,class:"text-sc-dark-grey my-2 text-center"},I4={key:2},A4={class:"text-sc-dark-grey mt-4 text-right font-bold"},O4={class:"text-sc-primary"},z4={class:"mb-4 max-w-xs empty:hidden"},D4={},mm=t.defineComponent({...D4,__name:"order-info",props:{order:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1}},emits:["click:client-name"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.ref();t.provide(j.currentOrderInjectionKey,t.computed(()=>s.value??null));const a=(d=!0)=>{if("products"in i.order){s.value=new j.Order(i.order);return}d&&(o.value=!0),j.HttpRequester.getInstance(j.OrdersDataProvider).getOrder(i.order.id).then(u=>{s.value=u}).finally(()=>{d&&(o.value=!1)})},l=t.computed(()=>{var d;return(((d=s.value)==null?void 0:d.products)??[]).filter(u=>!u.isRemoved&&!u.replacementId)}),c=t.computed(()=>l.value.reduce((d,u)=>d+u.costRub,0).toLocaleString("ru-ru",{minimumFractionDigits:2}));return t.watch(()=>i.order,()=>{a(!1)}),t.onMounted(()=>{a()}),(d,u)=>{const f=F.NSpin;return o.value?(t.openBlock(),t.createElementBlock("div",F4,[t.createElementVNode("div",V4,[t.createVNode(f,{size:"small",class:"mb-2.5 align-middle"}),u[1]||(u[1]=t.createElementVNode("div",null,[t.createElementVNode("span",null,"Загрузка данных ...")],-1))])])):!s.value||s.value.products.length===0?(t.openBlock(),t.createElementBlock("div",M4," --- Не удалось загрузить данные о заказе --- ")):(t.openBlock(),t.createElementBlock("div",I4,[t.createVNode(dm,{products:l.value,"event-emitter":n.eventEmitter,"allow-edit":n.allowEdit},null,8,["products","event-emitter","allow-edit"]),t.createElementVNode("div",A4,[u[2]||(u[2]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",O4,t.toDisplayString(c.value)+" ₽",1)]),t.createVNode(fm,{order:s.value,"onClick:clientName":u[0]||(u[0]=h=>r("click:client-name",s.value.client,h))},null,8,["order"]),t.createElementVNode("div",z4,[t.createVNode(hm,{order:s.value,"show-erp-link":""},null,8,["order"])]),t.createVNode(um,{order:s.value},null,8,["order"])]))}}}),L4={},H4=t.defineComponent({...L4,__name:"order-actions",props:{orderContextButtonsConfig:{type:Function,default:void 0},onOrderContextSelect:{type:Function,default:void 0},order:{}},setup(n){const e=n,i=t.inject(Br,"small"),r=t.computed(()=>M.isNil(e.orderContextButtonsConfig)?[]:M.isFunction(e.orderContextButtonsConfig)?e.orderContextButtonsConfig(e.order):e.orderContextButtonsConfig),o=s=>{var a;(a=e.onOrderContextSelect)==null||a.call(e,e.order,s)};return(s,a)=>{var u;const l=$s,c=F.NButton,d=F.NDropdown;return((u=r.value)==null?void 0:u.length)>0?(t.openBlock(),t.createBlock(d,{key:0,options:r.value,size:t.unref(i),trigger:"click",onSelect:o},{default:t.withCtx(()=>[t.createVNode(c,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(l)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)}}}),W4={},j4=t.defineComponent({...W4,__name:"orders-list",props:t.mergeModels({fields:{},showAttachedUserColumn:{type:Boolean,default:!1},orderContextButtonsConfig:{},onOrderContextSelect:{},orderUrl:{},tableMinWidth:{default:1/0},filters:{default:void 0},sort:{default:void 0},pagination:{default:void 0},useCellIndication:{type:Boolean,default:!1},highlightSettings:{default:void 0},enableSorting:{type:Boolean,default:!1},refreshInterval:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0},selectable:{type:Boolean,default:!1},isRowSelectable:{type:Function,default:void 0}},{checkedRowKeys:{default:()=>[]},checkedRowKeysModifiers:{}}),emits:t.mergeModels(["click:client-name","dblclick:row","update:pagination","update:sort"],["update:checkedRowKeys"]),setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useModel(n,"checkedRowKeys"),a=(P,q)=>{q?s.value.includes(P)||(s.value=[...s.value,P]):s.value=s.value.filter(K=>K!==P)},l=()=>M.cloneDeep(r.sort??[{field:"id",direction:"desc"}]),c=t.ref(l()),d=t.ref([]),u=t.ref(!1),f=t.ref(700),h=()=>{const P=Xe.getDeviceTypeByResolution(),q=P===je.phone||P===je.tablet;if(!(!r.stickyHeaderOnMobile&&q))return f.value*(j.useBaseConfigStateStore().config.tableDefaultHeightCoefficient??.6)},p=t.ref(h()),m=t.computed(()=>r.highlightSettings?r.highlightSettings:{statuses:[],markers:r.useCellIndication?[...so]:[]}),g=P=>{const q={onDblclick:()=>o("dblclick:row",P)},K=[];r.selectable&&s.value.length>0&&!s.value.includes(P.id)&&K.push("opacity-60");const J=m.value,Y=new Set(Ns(P).filter(ce=>J.markers.includes(ce))),V={},ie=[rt.NotInStock,rt.OnOrder,rt.LargeOrder].find(ce=>Y.has(ce));if(ie){const ce=Sr(ie);K.push("order-id-marked",ie),V["--sc-order-id-bg"]=ce.backgroundColor,V["--sc-order-id-text"]=ce.textOnBackgroundColor}if(Y.has(rt.NextDayDelivery)){const ce=Sr(rt.NextDayDelivery);K.push("delivery-date-marked"),V["--sc-delivery-date-bg"]=ce.backgroundColor,V["--sc-delivery-date-text"]=ce.textOnBackgroundColor}return P.status.slug&&J.statuses.includes(P.status.slug)&&(K.push("order-status-highlighted",P.status.slug),M.assign(V,jl(P.status.slug))),M.isEmpty(V)||(q.style=V),K.length>0&&(q.class=K.join(" ")),q},b=()=>{const P=[Me.CreatedAt,Me.Id,Me.ClientInfo,Me.ClientCity,Me.DeliveryDate,Me.PaymentType,Me.SalesDirections,Me.Status,...r.showAttachedUserColumn?[Me.AttachedUser]:[],Me.actions],q=r.fields.length>0?r.fields:P,K={title:"???",key:"undefined",render:()=>t.h("span",{},["--- unknown ---"])},J={type:"expand",expandable:M.constant(!0),renderExpand:A=>t.h(mm,{order:A,class:"pl-10 pt-3 pb-10","onClick:client-name":()=>{o("click:client-name",A.client,null)}}),width:"30"};let Y=[{title:"Дата заказа",key:Me.CreatedAt,resizable:!0,width:100,render:A=>t.h(Ko,{date:A.createdAt,isTimeSecondary:!0,isTimeOnSecondLine:!0,class:"text-base"})},{title:"№ заказа",key:Me.Id,resizable:!0,width:75,className:"order-id",render:A=>t.h("a",{href:r.orderUrl.replace(":id",A.id.toString()),class:"text-base"},A.id)},{title:"Дата доставки / самовывоза",key:Me.DeliveryDate,resizable:!0,width:120,className:"delivery-date",render:A=>t.h(Ko,{date:A.delivery.date,isShowTime:!1,class:"text-base"})},{title:"Клиент",key:Me.ClientInfo,resizable:!0,minWidth:320,render:A=>t.h(Ir,{client:A.client,"onClick:client-name":()=>{o("click:client-name",A.client,null)}})},{title:"Тип доставки",key:Me.DeliveryInfo,resizable:!0,minWidth:320,render:A=>t.h(gs,{delivery:A.delivery})},{title:"Клиент",key:Me.ClientInfoShort,resizable:!0,minWidth:320,render:A=>t.h(Ir,{client:A.client,showCityAndRegion:!1,"onClick:client-name":()=>{o("click:client-name",A.client,null)}})},{title:"Город клиента",key:Me.ClientCity,resizable:!0,minWidth:90,width:120,render:A=>{var ie;return t.h("span",{class:"text-base"},((ie=A.client)==null?void 0:ie.city.name)??"—")}},{title:"Статус",key:Me.Status,resizable:!0,width:150,minWidth:115,className:"order-status",render:A=>t.h("span",{class:"text-base"},[A.status.name])},{title:"Тип оплаты",key:Me.PaymentType,resizable:!0,width:115,minWidth:95,render:A=>A.payment?t.h(pl,{payment:A.payment}):t.h("span",{class:"text-base"},"—")},{title:"Напр. продаж",key:Me.SalesDirections,resizable:!0,width:80,render:A=>{var ie;return t.h("span",{class:"text-base"},[((ie=A.salesDirection)==null?void 0:ie.name)??""])}},...r.showAttachedUserColumn?[{title:"Закреплено за",key:Me.AttachedUser,resizable:!0,minWidth:120,render:A=>{var ie;return t.h("span",{class:"text-base"},[((ie=A==null?void 0:A.attachedUser)==null?void 0:ie.name)??""])}}]:[]];r.orderContextButtonsConfig&&Y.push({key:"actions",title:"",className:"align-top",width:50,render:A=>t.h(H4,{order:A,orderContextButtonsConfig:r.orderContextButtonsConfig,onOrderContextSelect:r.onOrderContextSelect})}),r.enableSorting&&(Y=Y.map(A=>[Me.Id,Me.CreatedAt,Me.DeliveryDate].includes(A.key)?{...A,sorter:!0,sortOrder:!1,...A.width===void 0?{}:{width:A.width+16}}:A));const V=r.selectable?[{key:"selection",title:"",className:"align-top",width:"32",cellProps:A=>{var ce;const ie=((ce=r.isRowSelectable)==null?void 0:ce.call(r,A))??!0;return{class:ie?"cursor-pointer":void 0,onClick:()=>{ie&&a(A.id,!s.value.includes(A.id))}}},render:A=>{var ie;return((ie=r.isRowSelectable)==null?void 0:ie.call(r,A))??!0?t.h(F.NCheckbox,{checked:s.value.includes(A.id)}):null}}]:[];switch(Xe.getDeviceTypeByResolution()){case je.phone:case je.tablet:return[...V,J,{key:"order",title:"Заказ",resizable:!0,render:A=>t.h(am,{order:A,fields:q,orderUrl:r.orderUrl,highlightSettings:m.value})}];case je.laptop:{const A=r.showAttachedUserColumn?q:q.filter(ie=>ie!==Me.AttachedUser);return[...V,J,...A.map(ie=>Y.find(ce=>ce.key===ie)??K)]}default:return[K]}},y=t.ref(b()),_=t.ref(new j.TableDataPagination(r.pagination??{page:1,pageSize:10,itemCount:0,pageCount:1,pageSlot:5,pageSizes:[10,15,25],showSizePicker:!0})),k=t.computed(()=>({..._.value,prefix({itemCount:P}){return`Всего заказов: ${P}`}})),x=t.ref(null),v=t.ref(null),B=t.ref(null),w=t.ref(null),T=t.ref(null),C=()=>{T.value!==null&&(clearInterval(T.value),T.value=null)},$=()=>{C(),r.refreshInterval&&(T.value=setInterval(()=>{R()},r.refreshInterval))},E=P=>{_.value.itemCount!==P.meta.total&&(_.value.itemCount=P.meta.total),_.value.page!==P.meta.currentPage&&(_.value.page=P.meta.currentPage),_.value.pageCount!==P.meta.lastPage&&(_.value.pageCount=P.meta.lastPage),_.value.pageSize!==P.meta.perPage&&(_.value.pageSize=P.meta.perPage),d.value=P.data},I=()=>{var P,q,K;r.filters&&((P=v.value)==null||P.abort(),v.value=null,(q=B.value)==null||q.abort(),B.value=null,w.value=null,(K=x.value)==null||K.abort(),x.value=new AbortController,u.value=!0,j.HttpRequester.getInstance(j.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},x.value.signal).then(J=>{E(J),u.value=!1}).catch(J=>{if((J==null?void 0:J.name)!=="CanceledError")throw u.value=!1,J}))},R=()=>{var P;!r.filters||u.value||((P=v.value)==null||P.abort(),v.value=new AbortController,j.HttpRequester.getInstance(j.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},v.value.signal).then(q=>{d.value=d.value.map(K=>q.data.find(Y=>Y.id===K.id)??K),_.value.itemCount!==q.meta.total&&(_.value.itemCount=q.meta.total),_.value.pageCount!==q.meta.lastPage&&(_.value.pageCount=q.meta.lastPage)}).catch(q=>{if((q==null?void 0:q.name)!=="CanceledError")throw q}))},O=P=>P.meta.total===_.value.itemCount&&M.isEqual(M.map(P.data,"id"),M.map(d.value,"id")),U=async()=>{var q,K;if(!r.filters||u.value)return!1;(q=v.value)==null||q.abort(),v.value=null,(K=B.value)==null||K.abort(),B.value=new AbortController;let P;try{P=await j.HttpRequester.getInstance(j.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},B.value.signal)}catch(J){if((J==null?void 0:J.name)==="CanceledError")return!1;throw J}return O(P)?(d.value=d.value.map(J=>P.data.find(Y=>Y.id===J.id)??J),w.value=null,!1):(w.value=P,!0)},Q=()=>w.value?(E(w.value),w.value=null,!0):!1,G=()=>{w.value=null},W=P=>{_.value.page=P,I(),o("update:pagination",_.value)},D=P=>{_.value.pageSize=P,_.value.page=1,I(),o("update:pagination",_.value)},L=P=>{if(M.isNull(P))c.value=l();else{const[q]=c.value;q.field=P.columnKey.toString(),q.direction=P.order==="ascend"?"asc":"desc",c.value=[q]}y.value.forEach(q=>{if(Object.hasOwn(q,"sortOrder")){const K=q;K.sortOrder=K.key===(P==null?void 0:P.columnKey)&&(P!=null&&P.sorter)&&P.order!==!1?P.order:!1}}),I(),o("update:sort",c.value)},z=()=>{y.value=b(),f.value=window.innerHeight,p.value=h()};return t.watch(()=>r.filters,()=>{_.value.page=1,I(),$()}),t.watch(()=>r.sort,()=>{c.value=l(),_.value.page=1,I(),$()}),t.onMounted(()=>{z(),window.addEventListener("resize",z),t.nextTick(()=>{I(),$()})}),t.onUnmounted(()=>{var P,q,K;window.removeEventListener("resize",z),(P=x.value)==null||P.abort(),(q=v.value)==null||q.abort(),(K=B.value)==null||K.abort(),C()}),e({reload:I,checkForUpdates:U,applyPendingUpdate:Q,discardPendingUpdate:G}),(P,q)=>{const K=F.NDataTable;return t.openBlock(),t.createBlock(K,{columns:y.value,data:d.value,"row-key":J=>J.id,"row-props":g,"scroll-x":n.tableMinWidth,pagination:k.value,loading:u.value,remote:!0,bordered:!1,"bottom-bordered":!1,"sticky-expanded-rows":!0,"max-height":p.value,"pagination-behavior-on-filter":"first","onUpdate:page":W,"onUpdate:pageSize":D,"onUpdate:sorter":L},null,8,["columns","data","row-key","scroll-x","pagination","loading","max-height"])}}}),q4=fn(j4,[["__scopeId","data-v-aff76adb"]]),X4=t.computed(()=>j.useReferencesStore().deliveryTypeReference??[]),Y4=t.computed(()=>j.useReferencesStore().managersList??[]),U4=t.computed(()=>j.useReferencesStore().opfReference??[]),K4=t.computed(()=>j.useReferencesStore().partnerGroupsReference??[]),G4=t.computed(()=>j.useReferencesStore().priceCoefficientsReference??[]),Z4=t.computed(()=>j.useReferencesStore().productFilesTypesReference??[]),Q4=t.computed(()=>j.useReferencesStore().resourceTypesReference),J4=t.computed(()=>j.useReferencesStore().salesDirectionsReference??[]),eN=t.computed(()=>j.useReferencesStore().warehousesReference??[]),tN=t.computed(()=>j.useReferencesStore().paymentTypeReference??[]),pm=t.computed(()=>j.useReferencesStore().orderStatusReference??[]),nN=t.computed(()=>j.useReferencesStore().orderStatusDetailReference??[]),iN=t.computed(()=>j.useReferencesStore().operatorReference??[]),rN=t.computed(()=>_t.convertReferencesToSelectOptionsList(j.useReferencesStore().channelPrimaryInterestsReference??[],!0,!1,!0)),oN=t.computed(()=>_t.convertReferencesToSelectOptionsList(j.useReferencesStore().sourcePrimaryInterestsReference??[],!0,!1,!0)),sN=n=>j.HttpRequester.getInstance(j.ReferenceDataProvider).searchCity(n),aN=n=>_t.convertReferencesToSelectOptionsList(n,!0,!1,!1,e=>{var i,r,o;return e!=null&&e.isNewRec()?"-":`${e.name}, ${(i=e==null?void 0:e.region)==null?void 0:i.name}, ${(o=(r=e==null?void 0:e.region)==null?void 0:r.country)==null?void 0:o.name}`},e=>e==null?void 0:e.isNewRec()),lN=n=>j.HttpRequester.getInstance(j.ClientDataProvider).searchClient(n),cN=n=>_t.convertReferencesToSelectOptionsList(n,!0,!1,!1,e=>e.isNewRec()?"-":[e.name,e.salesDirection.name?`(${e.salesDirection.name})`:void 0,e.city.name?`г. ${e.city.name}${e.city.region.name?`, ${e.city.region.name}`:""}`:void 0,e.isActive?void 0:"[ Деактивирован ]"].filter(Boolean).join(" "),e=>e==null?void 0:e.isNewRec()),dN={class:"flex flex-col gap-4"},uN={class:"flex flex-wrap gap-2"},fN={class:"flex flex-col gap-1.5"},hN={class:"inline-flex items-center gap-2"},mN={class:"flex flex-col gap-1.5"},pN={class:"inline-flex items-center gap-2"},gN={},yN=t.defineComponent({...gN,__name:"order-highlight-settings",props:{settings:{},statuses:{default:void 0}},emits:["update:settings"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>i.statuses??pm.value),s=d=>!!d&&i.settings.statuses.includes(d),a=(d,u)=>{if(!d)return;const f=i.settings.statuses.filter(h=>h!==d);r("update:settings",{...i.settings,statuses:u?[...f,d]:f})},l=(d,u)=>{const f=i.settings.markers.filter(h=>h!==d);r("update:settings",{...i.settings,markers:u?[...f,d]:f})},c=d=>{r("update:settings",{statuses:d?o.value.flatMap(u=>u.slug?[u.slug]:[]):[],markers:d?[...so]:[]})};return(d,u)=>{const f=F.NButton,h=F.NCheckbox;return t.openBlock(),t.createElementBlock("div",dN,[t.createElementVNode("div",uN,[t.createVNode(f,{size:"small",onClick:u[0]||(u[0]=p=>c(!0))},{default:t.withCtx(()=>[...u[2]||(u[2]=[t.createTextVNode(" Выделять всё ",-1)])]),_:1}),t.createVNode(f,{size:"small",onClick:u[1]||(u[1]=p=>c(!1))},{default:t.withCtx(()=>[...u[3]||(u[3]=[t.createTextVNode(" Снять всё ",-1)])]),_:1})]),t.createElementVNode("div",fN,[u[4]||(u[4]=t.createElementVNode("div",{class:"text-sm font-semibold"},"Статусы",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,p=>(t.openBlock(),t.createBlock(h,{key:p.id,checked:s(p.slug),"onUpdate:checked":m=>a(p.slug,m)},{default:t.withCtx(()=>[t.createElementVNode("span",hN,[t.createVNode(gl,{colors:t.unref(wi)(p.slug)},null,8,["colors"]),t.createTextVNode(" "+t.toDisplayString(p.name),1)])]),_:2},1032,["checked","onUpdate:checked"]))),128))]),t.createElementVNode("div",mN,[u[5]||(u[5]=t.createElementVNode("div",{class:"text-sm font-semibold"},"Маркеры",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(so),p=>(t.openBlock(),t.createBlock(h,{key:p,checked:n.settings.markers.includes(p),"onUpdate:checked":m=>l(p,m)},{default:t.withCtx(()=>[t.createElementVNode("span",pN,[t.createVNode(gl,{colors:t.unref(Sr)(p)},null,8,["colors"]),t.createTextVNode(" "+t.toDisplayString(t.unref(Bs)(p)),1)])]),_:2},1032,["checked","onUpdate:checked"]))),128))])])}}}),bN=["href"],_N={class:"text-sc-dark-grey"},wN={},xN=t.defineComponent({...wN,__name:"short-text-order-info",props:{order:{},orderLink:{}},emits:["click:order-id"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>xe.format(i.order.createdAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime)),s=a=>{M.isNil(i.orderLink)&&(a.preventDefault(),a.stopPropagation()),r("click:order-id",i.order,a)};return(a,l)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("span",null,[l[1]||(l[1]=t.createTextVNode(" #",-1)),t.createElementVNode("a",{href:n.orderLink??"#",onClick:l[0]||(l[0]=c=>s(c))},t.toDisplayString(n.order.id),9,bN),t.createTextVNode(" от "+t.toDisplayString(o.value),1)]),l[2]||(l[2]=t.createTextVNode(", ",-1)),t.createElementVNode("span",_N,"автор: "+t.toDisplayString(n.order.creator.name)+" ["+t.toDisplayString(n.order.creator.type)+"]",1)],64))}}),kN={class:"sc-page flex flex-col bg-inherit"},CN={class:"my-2 flex flex-row items-end"},vN={class:"sc-title grow"},SN={key:0,class:"sc-title-buttons flex-1 grow-0"},BN={class:"flex flex-col justify-end gap-1 sm:mt-0 sm:flex-row"},NN={key:0,class:"sc-title-extra mt-2 sm:mt-4"},TN={},gm=t.defineComponent({...TN,__name:"page",props:{title:{default:void 0},stickyHeader:{type:Boolean},stickyTopOffset:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>e.stickyHeaderOnMobile?"sticky z-10 bg-inherit":"lg:sticky z-10 bg-inherit");return(r,o)=>{const s=F.NH1;return t.openBlock(),t.createElementBlock("div",kN,[t.createElementVNode("div",{class:t.normalizeClass(n.stickyHeader?i.value:void 0),style:t.normalizeStyle(n.stickyHeader?{top:`${n.stickyTopOffset??0}px`}:void 0)},[t.createElementVNode("div",CN,[t.createElementVNode("div",vN,[t.renderSlot(r.$slots,"title",{},()=>[t.createVNode(s,{class:"m-0 leading-none lg:mb-3 lg:leading-normal"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.title??""),1)]),_:1})])]),r.$slots["title-buttons"]?(t.openBlock(),t.createElementBlock("div",SN,[t.createElementVNode("div",BN,[t.renderSlot(r.$slots,"title-buttons")])])):t.createCommentVNode("",!0)]),r.$slots["title-extra"]?(t.openBlock(),t.createElementBlock("div",NN,[t.renderSlot(r.$slots,"title-extra")])):t.createCommentVNode("",!0),t.renderSlot(r.$slots,"sticky-extra")],6),t.renderSlot(r.$slots,"default")])}}}),$N={class:"overflow-hidden transition-all duration-300"},EN={class:"text-lg font-medium leading-none"},RN={},ym=t.defineComponent({...RN,__name:"sliding-content-with-drawer",props:{drawerWidth:{type:[Number,Function],default:void 0},showDrawer:{type:Boolean,default:!1},title:{default:""}},emits:["update:show-drawer"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(0),s=t.ref(i.showDrawer),a=()=>{switch(Xe.getDeviceTypeByResolution()){case je.phone:return window.innerWidth*.8;case je.tablet:return window.innerWidth*.5;default:return window.innerWidth*.33}},l=()=>{s.value?M.isUndefined(i.drawerWidth)?o.value=a():o.value=M.isFunction(i.drawerWidth)?i.drawerWidth():i.drawerWidth:o.value=0};return t.watch(()=>i.drawerWidth,()=>{l()}),t.watch(()=>s.value,()=>{l(),r("update:show-drawer",s.value)}),t.watch(()=>i.showDrawer,c=>{s.value=c}),t.onUnmounted(()=>{window.removeEventListener("resize",l)}),l(),window.addEventListener("resize",l),(c,d)=>{const u=F.NDrawerContent,f=F.NDrawer;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",$N,[t.createElementVNode("div",{style:t.normalizeStyle(`margin-left: ${o.value}px;`),class:"w-full"},[t.renderSlot(c.$slots,"default")],4)]),t.createVNode(f,{show:s.value,"onUpdate:show":d[0]||(d[0]=h=>s.value=h),resizable:!0,width:o.value,placement:"left"},{default:t.withCtx(()=>[t.createVNode(u,{closable:""},{header:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-header",{},()=>[t.createElementVNode("div",EN,t.toDisplayString(n.title),1)])]),default:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-content")]),footer:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-footer")]),_:3})]),_:3},8,["show","width"])],64)}}}),PN={ref:"panel-component-ref",class:"sc-page-panel flex flex-row gap-2.5 bg-inherit sm:gap-8"},FN={key:0},VN={class:"sc-page-preview-panel grow"},MN={key:1,class:"sc-page-preview-panel-extra flex-none"},IN={},AN=t.defineComponent({...IN,__name:"page-with-sliding-panel",props:{title:{},isShowPanelButtonVisible:{type:Boolean,default:!0},showPanelButtonText:{default:""},panelTitle:{default:""},stickyHeader:{type:Boolean,default:!1},stickyTopOffset:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0}},setup(n,{expose:e}){const i=t.ref(!1),r=()=>{i.value=!0},o=()=>{i.value=!1},s=t.useTemplateRef("panel-component-ref");return e({scrollToTopOfPanel:l=>{var c;(c=s.value)==null||c.scrollIntoView({behavior:"smooth"}),l&&t.nextTick(()=>{var d,u;window.scrollTo({top:(((u=(d=s.value)==null?void 0:d.getBoundingClientRect())==null?void 0:u.top)??0)+window.pageYOffset+l,behavior:"smooth"})})},showPanel:r,closePanel:o}),(l,c)=>{const d=F.NButton;return t.openBlock(),t.createBlock(gm,{title:n.title,"sticky-header":n.stickyHeader,"sticky-top-offset":n.stickyTopOffset,"sticky-header-on-mobile":n.stickyHeaderOnMobile},t.createSlots({default:t.withCtx(()=>[t.createVNode(ym,{"show-drawer":i.value,"onUpdate:showDrawer":c[1]||(c[1]=u=>i.value=u),title:n.panelTitle},t.createSlots({"drawer-content":t.withCtx(()=>[t.renderSlot(l.$slots,"panel-content")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"default")]),_:2},[l.$slots["panel-header"]?{name:"drawer-header",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"panel-header")]),key:"0"}:void 0,l.$slots["panel-bottom"]?{name:"drawer-footer",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"panel-bottom")]),key:"1"}:void 0]),1032,["show-drawer","title"])]),_:2},[l.$slots.title?{name:"title",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title")]),key:"0"}:void 0,l.$slots["title-buttons"]?{name:"title-buttons",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title-buttons")]),key:"1"}:void 0,l.$slots["title-extra"]?{name:"title-extra",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title-extra")]),key:"2"}:void 0,l.$slots["preview-panel"]||l.$slots["preview-panel-extra"]||n.isShowPanelButtonVisible?{name:"sticky-extra",fn:t.withCtx(()=>[t.createElementVNode("div",PN,[n.isShowPanelButtonVisible?(t.openBlock(),t.createElementBlock("div",FN,[t.renderSlot(l.$slots,"show-panel-button",{onClickHandler:()=>{i.value=!0}},()=>[t.createVNode(d,{class:"flex-none sm:px-10 sm:py-4",onClick:c[0]||(c[0]=u=>i.value=!0)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.showPanelButtonText),1)]),_:1})])])):t.createCommentVNode("",!0),t.createElementVNode("div",VN,[t.renderSlot(l.$slots,"preview-panel")]),l.$slots["preview-panel-extra"]?(t.openBlock(),t.createElementBlock("div",MN,[t.renderSlot(l.$slots,"preview-panel-extra")])):t.createCommentVNode("",!0)],512)]),key:"3"}:void 0]),1032,["title","sticky-header","sticky-top-offset","sticky-header-on-mobile"])}}}),ON={},zN=t.defineComponent({...ON,__name:"curator-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},managerReferenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=t.computed(()=>{var m;return M.isArray(r.value)?r.value.map(g=>g.id):((m=r.value)==null?void 0:m.id)??null}),l=t.computed(()=>{const m=new j.Curator({id:-1,name:"",contacts:{},curatedDirection:new j.CuratedDirection({id:-1,name:"",guid:""}),guid:""}),g=r.showEmptyValue?[m]:[];return r.managerReferenceList.filter(b=>{var y;return(((y=b==null?void 0:b.curatedDirections)==null?void 0:y.length)??0)>0}).forEach(b=>{((b==null?void 0:b.curatedDirections)??[]).forEach(y=>{g.push(new j.Curator({id:b.id,guid:b.guid,name:b.name,photo:b.photo,contacts:b.contacts??{},curatedDirection:y}))})}),g}),c=t.computed(()=>_t.convertReferencesToSelectOptionsList(l.value,!0,{key:"item.curatedDirection.id",label:"item.curatedDirection.name"},!1,m=>{const g=M.some(s.value?r.value:[r.value],["id",m.id])?` (${m.curatedDirection.name}) `:"";return m.curatedDirection.isNewRec()?m.name:`${m.name}${g}`})),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=t.useTemplateRef("select-component"),f=m=>{if(M.isArray(m)){const g=m.length>0?m.map(b=>l.value.find(y=>y.id===b)).filter(b=>!M.isNil(b)):[];o("update:value",g)}else{const g=m>0?l.value.find(b=>b.id===m):null;o("update:value",g??null)}};return t.watch(()=>r.value,()=>{var m,g;(g=(m=u.value)==null?void 0:m.$forceUpdate)==null||g.call(m)},{deep:!0}),e({focus:()=>{var m;return(m=u.value)==null?void 0:m.focusInput()},blur:()=>{var m;return(m=u.value)==null?void 0:m.blurInput()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(F.NSelect),{ref:"select-component",value:a.value,clearable:n.clearable,disabled:c.value.length===0,"consistent-menu-width":n.consistentMenuWidth,multiple:s.value,options:d.value,placeholder:"","onUpdate:value":f},null,8,["value","clearable","disabled","consistent-menu-width","multiple","options"]))}}),DN={},LN=t.defineComponent({...DN,__name:"manager-operator-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!1},managerReferenceList:{default:()=>[]},operatorReferenceList:{default:()=>[]},showActualOnly:{type:Boolean,default:!1},groupByEmployeeType:{type:Boolean,default:!1},filterable:{type:Boolean,default:!0},maxTagCount:{default:void 0}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=t.computed(()=>{var y;return M.isArray(r.value)?r.value.filter(_=>!M.isNil(_)).map(_=>_.id):((y=r.value)==null?void 0:y.id)??null}),l=t.computed(()=>[...r.operatorReferenceList,...r.managerReferenceList]),c=t.computed(()=>{var x;const y=[];r.operatorReferenceList.length>0&&y.push({type:"group",label:"Операторы",key:"operators",children:r.operatorReferenceList.map(v=>({label:v.name,value:v.id,item:v}))});let _=r.managerReferenceList;if(r.showActualOnly){const v=M.isArray(r.value)?r.value.map(B=>B.id):[(x=r.value)==null?void 0:x.id];_=_.filter(B=>B.isActive||v.includes(B.id))}const k=_t.convertReferencesToSelectOptionsList(_,!0,{key:"item.salesDirection.id",label:"item.salesDirection.name"},!1,v=>`${v.name}${v.isActive?"":" [Не активен]"}`);return y.length>0&&k.length>0&&y.push({key:"manager-operator-divider",disabled:!0,render:()=>t.h("div",{class:"sc-manager-operator-select__divider"})}),y.push(...k),y}),d=y=>`${y.name}${"isActive"in y&&!y.isActive?" [Не активен]":""}`,u=t.computed(()=>{var B;const y=M.isArray(r.value)?r.value.map(w=>w.id):[(B=r.value)==null?void 0:B.id],_=w=>r.showActualOnly?w.filter(T=>!("isActive"in T)||T.isActive||y.includes(T.id)):w,k=[],x=_(r.managerReferenceList);x.length>0&&k.push({type:"group",label:"Менеджеры",key:"managers",children:_t.convertReferencesToSelectOptionsList(x,!0,!1,!1,d)});const v=_(r.operatorReferenceList);return v.length>0&&k.push({type:"group",label:"Операторы",key:"operators",children:_t.convertReferencesToSelectOptionsList(v,!0,!1,!1,d)}),k}),f=t.computed(()=>r.groupByEmployeeType?u.value:c.value),h=t.computed(()=>f.value.map(y=>({...y,class:r.wrapContent?`${y.class??""} consistent-menu-width`:y.class}))),p=t.useTemplateRef("select-component"),m=y=>{if(M.isArray(y)){const _=y.map(k=>l.value.find(x=>x.id===k)).filter(k=>!M.isNil(k));o("update:value",_)}else{const _=M.isNil(y)?null:l.value.find(k=>k.id===y)??null;o("update:value",_)}};return t.watch(()=>r.value,()=>{var y,_;(_=(y=p.value)==null?void 0:y.$forceUpdate)==null||_.call(y)},{deep:!0}),e({focus:()=>{var y;return(y=p.value)==null?void 0:y.focusInput()},blur:()=>{var y;return(y=p.value)==null?void 0:y.blurInput()}}),(y,_)=>(t.openBlock(),t.createBlock(t.unref(F.NSelect),{ref:"select-component",value:a.value,"clear-filter-after-select":!0,clearable:n.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled||f.value.length===0,filterable:n.filterable,"max-tag-count":n.maxTagCount,multiple:s.value,options:h.value,placeholder:"",class:"w-full","onUpdate:value":m},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),HN={},WN=t.defineComponent({...HN,__name:"manager-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!0},managerReferenceList:{default:()=>[]},disabledManagerReferenceList:{default:()=>[]},showActualOnly:{type:Boolean,default:!1},showEmptyValue:{type:Boolean,default:!1},groupBySalesDirection:{type:Boolean,default:!1}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=t.computed(()=>{var m;return M.isArray(r.value)?r.value.map(g=>g.id):((m=r.value)==null?void 0:m.id)??null}),l=t.computed(()=>r.showEmptyValue?[j.ManagerDataFactory.generateUndefinedManagerInstance(),...r.managerReferenceList]:r.managerReferenceList),c=t.computed(()=>{var b;let m=l.value,g=r.disabledManagerReferenceList.map(y=>y.id);if(r.showActualOnly){const y=M.isArray(r.value)?r.value.map(_=>_.id):[(b=r.value)==null?void 0:b.id];g=M.union(g,l.value.filter(_=>!_.isActive).map(_=>_.id)),m=m.filter(_=>(r.showEmptyValue?j.ManagerDataFactory.isUndefinedManagerInstance(_):!1)||_.isActive||y.includes(_.id))}return _t.convertReferencesToSelectOptionsList(m,!0,r.groupBySalesDirection?{key:"item.salesDirection.id",label:"item.salesDirection.name"}:!1,!1,y=>{const _=!r.groupBySalesDirection||r.groupBySalesDirection&&M.some(s.value?r.value:[r.value],["id",y.id])?` (${y.salesDirection.name}) `:"";return y.salesDirection.isNewRec()?y.name:`${y.name}${_}${y.isActive?"":" [Не активен]"}`},y=>g.includes(y.id)&&y.isActive)}),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=t.useTemplateRef("select-component"),f=m=>{if(M.isArray(m)){const g=m.length>0?m.filter(b=>!M.some(r.disabledManagerReferenceList,["id",b])).map(b=>l.value.find(y=>y.id===b)).filter(b=>!M.isNil(b)):[];o("update:value",g)}else{const g=m>0&&!M.some(r.disabledManagerReferenceList,["id",m])?l.value.find(b=>b.id===m):new j.Manager;o("update:value",g??new j.Manager)}};return t.watch(()=>r.value,()=>{var m,g;(g=(m=u.value)==null?void 0:m.$forceUpdate)==null||g.call(m)},{deep:!0}),t.watch(()=>r.disabledManagerReferenceList,m=>{if(m.length>0&&r.value)if(s.value){const g=r.value;M.some(g,b=>M.some(m,["id",b.id]))&&o("update:value",g.filter(b=>!M.some(m,["id",b.id])))}else{const g=r.value;M.some(m,["id",g.id])&&o("update:value",new j.Manager)}}),e({focus:()=>{var m;return(m=u.value)==null?void 0:m.focusInput()},blur:()=>{var m;return(m=u.value)==null?void 0:m.blurInput()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(F.NSelect),{ref:"select-component",value:a.value,clearable:n.clearable,disabled:c.value.length===0,"consistent-menu-width":n.consistentMenuWidth,multiple:s.value,options:d.value,placeholder:"","onUpdate:value":f},null,8,["value","clearable","disabled","consistent-menu-width","multiple","options"]))}}),jN={class:"m-0.5 flex flex-col p-0.5"},qN={class:"flex flex-row gap-1"},XN={key:0},YN={key:1},UN={key:2},KN={key:3},GN={class:"flex flex-row gap-1"},ZN={key:0},QN={key:1},JN={key:2},eT={key:3},tT={},bm=t.defineComponent({...tT,__name:"address-suggestion-label",props:{addr:{},selected:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",jN,[t.createElementVNode("span",qN,[n.addr.postIndex?(t.openBlock(),t.createElementBlock("span",XN,t.toDisplayString(n.addr.postIndex)+", ",1)):t.createCommentVNode("",!0),n.addr.city?(t.openBlock(),t.createElementBlock("span",YN,t.toDisplayString(n.addr.city)+", ",1)):t.createCommentVNode("",!0),n.addr.locality?(t.openBlock(),t.createElementBlock("span",UN,t.toDisplayString(n.addr.locality)+", ",1)):t.createCommentVNode("",!0),n.addr.region?(t.openBlock(),t.createElementBlock("span",KN,t.toDisplayString(n.addr.region)+", ",1)):t.createCommentVNode("",!0)]),t.createElementVNode("span",GN,[n.addr.street?(t.openBlock(),t.createElementBlock("span",ZN,t.toDisplayString(n.addr.street)+", ",1)):t.createCommentVNode("",!0),n.addr.building?(t.openBlock(),t.createElementBlock("span",QN,t.toDisplayString(n.addr.building)+", ",1)):t.createCommentVNode("",!0),n.addr.buildingPart?(t.openBlock(),t.createElementBlock("span",JN,t.toDisplayString(n.addr.buildingPart)+", ",1)):t.createCommentVNode("",!0),n.addr.apartments?(t.openBlock(),t.createElementBlock("span",eT,t.toDisplayString(n.addr.apartments)+", ",1)):t.createCommentVNode("",!0)])]))}}),bl={clearable:!1,value:"",field:void 0,disabled:!1},nT={},iT=t.defineComponent({...nT,__name:"address-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},searchDataHandler:{type:Function}},{...bl,minTermLength:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},searchDataHandler:void 0,wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=t.computed(()=>l.value.map(g=>({label:g[r.field??"addressString"]??"-",value:g.id})));t.watch(()=>r.value,g=>{s.value=g}),t.watch(s,()=>{o("update:value",s.value)});const d=M.debounce(()=>u(),800),u=async()=>{!s.value||s.value.length<r.minTermLength||(a.value=!0,l.value=await(r.searchDataHandler?r.searchDataHandler(s.value,a):j.HttpRequester.getInstance(j.DataSuggestionProvider).searchAddresses(s.value)).finally(()=>{a.value=!1}))},f=(g,b)=>{const y=l.value.find(_=>_.id===g.value)||{};return t.h(bm,{addr:y,selected:b},{default:M.constant("-")})},h=g=>{d.cancel();const b=l.value.find(y=>y.id===g)||{};o("select",b)},p=t.ref(null);function m(){p.value.focus()}return e({focus:m}),(g,b)=>{const y=F.NAutoComplete;return t.openBlock(),t.createBlock(y,{ref_key:"autoCompleteElement",ref:p,value:s.value,"onUpdate:value":[b[0]||(b[0]=_=>s.value=_),t.unref(d)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:c.value,"render-label":f,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:h},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}}),rT={class:"m-0.5 flex flex-col p-0.5"},oT={class:"font-medium"},sT={class:"flex flex-row gap-1 text-xs font-light text-blue-800"},aT={key:0},lT={key:1},cT={},_m=t.defineComponent({...cT,__name:"bank-suggestion-label",props:{bank:{},selected:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",rT,[t.createElementVNode("span",oT,t.toDisplayString(n.bank.name),1),t.createElementVNode("span",sT,[n.bank.bic?(t.openBlock(),t.createElementBlock("span",aT," БИК: "+t.toDisplayString(n.bank.bic),1)):t.createCommentVNode("",!0),n.bank.inn?(t.openBlock(),t.createElementBlock("span",lT," ИНН: "+t.toDisplayString(n.bank.inn),1)):t.createCommentVNode("",!0)])]))}}),dT={},uT=t.defineComponent({...dT,__name:"bank-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean}},{...bl,minTermLength:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=t.computed(()=>l.value.map(g=>({label:g[r.field??"_"]??"-",value:g.id})));t.watch(()=>r.value,g=>{s.value=g}),t.watch(s,()=>{o("update:value",s.value)});const d=M.debounce(()=>u(),800),u=async()=>{if(!(!s.value||s.value.length<r.minTermLength)){a.value=!0;try{l.value=await j.HttpRequester.getInstance(j.DataSuggestionProvider).searchBank(s.value)}finally{a.value=!1}}},f=(g,b)=>{const y=l.value.find(_=>_.id===g.value)||{};return t.h(_m,{bank:y,selected:b},{default:M.constant("-")})},h=g=>{d.cancel();const b=l.value.find(y=>y.id===g)||{};o("select",b)},p=t.ref(null);function m(){p.value.focus()}return e({focus:m}),(g,b)=>{const y=F.NAutoComplete;return t.openBlock(),t.createBlock(y,{ref_key:"autoCompleteElement",ref:p,value:s.value,"onUpdate:value":[b[0]||(b[0]=_=>s.value=_),t.unref(d)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:c.value,"render-label":f,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:h},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}}),fT={class:"font-medium"},hT={key:0,class:"flex flex-row gap-2"},mT={key:0,class:"text-xs font-light text-blue-800"},pT={key:1,class:"text-sc-dark-grey text-xs font-light"},gT={},wm=t.defineComponent({...gT,__name:"org-suggestion-label",props:{org:{},selected:{type:Boolean}},setup(n){const e=n,i=t.computed(()=>{var o,s;return((s=(o=e.org.rawData)==null?void 0:o.state)==null?void 0:s.liquidationDate)??!1}),r=t.computed(()=>{var o,s;return((s=(o=e.org.rawData)==null?void 0:o.address)==null?void 0:s.value)??""});return(o,s)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(`m-0.5 flex flex-col p-0.5 ${i.value?"line-through":""}`)},[t.createElementVNode("span",fT,t.toDisplayString(n.org.name),1),n.org.inn||r.value?(t.openBlock(),t.createElementBlock("div",hT,[n.org.inn?(t.openBlock(),t.createElementBlock("span",mT,t.toDisplayString(n.org.inn),1)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("span",pT,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],2))}}),yT={},bT=t.defineComponent({...yT,__name:"org-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},allowSelectTerminated:{type:Boolean}},{...bl,minTermLength:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=b=>{var y,_;return!!(((_=(y=b.rawData)==null?void 0:y.state)==null?void 0:_.liquidationDate)??!1)},d=t.computed(()=>_t.convertReferencesToSelectOptionsList(l.value,!1,!1,!1,b=>b[r.field??"_"]??"-",b=>!r.allowSelectTerminated&&c(b)));t.watch(()=>r.value,b=>{s.value=b}),t.watch(s,()=>{o("update:value",s.value)});const u=M.debounce(()=>f(),800),f=async()=>{if(!(!s.value||s.value.length<r.minTermLength)){a.value=!0;try{l.value=await j.HttpRequester.getInstance(j.DataSuggestionProvider).searchOrganization(s.value)}finally{a.value=!1}}},h=(b,y)=>{const _=l.value.find(k=>k.id===b.value)||{};return t.h(wm,{org:_,selected:y},{default:M.constant("-")})},p=b=>{u.cancel();const y=l.value.find(_=>_.id===b)||{};(r.allowSelectTerminated||!c(y))&&o("select",y)},m=t.ref(null);function g(){m.value.focus()}return e({focus:g}),(b,y)=>{const _=F.NAutoComplete;return t.openBlock(),t.createBlock(_,{ref_key:"autoCompleteElement",ref:m,value:s.value,"onUpdate:value":[y[0]||(y[0]=k=>s.value=k),t.unref(u)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:d.value,"render-label":h,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:p},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}});X.ALL_ORDER_MARKERS=so,X.CATEGORY_REQUIRED_HINT=Cs,X.CommonValidators=Im,X.ConfiguratorSettingsKozyrek=$u,X.ConfiguratorSettingsMosquito=Nx,X.ContentHelper=xi,X.DEFAULT_ORDER_STATUS_COLORS=vs,X.DateValidators=Am,X.EntityNameHelper=si,X.FileHelper=Mm,X.KozyrekLine=Rn,X.KozyrekTailTemplate=$a,X.KozyrekTemplate=ur,X.MODE_DISABLED_HINT=kr,X.NumericValidators=le,X.ORDER_MARKER_COLORS=Ss,X.ORDER_MARKER_NAMES=ql,X.ORDER_STATUS_COLORS=Hl,X.OrderMarkerEnum=rt,X.OrdersTableFields=Me,X.PRODUCT_REQUIRED_HINT=ks,X.Point=Ta,X.ScAddProductToCartDialog=ww,X.ScAddressSuggestion=iT,X.ScAddressSuggestionLabel=bm,X.ScBankSuggestion=uT,X.ScBankSuggestionLabel=_m,X.ScBaseDialog=Ps,X.ScButtonWithConfirmAction=zm,X.ScCategoryCollapse=Ku,X.ScChipGroup=Hm,X.ScClientNameWithShortInfo=Ir,X.ScCollapse=Uu,X.ScCollapseItem=Jl,X.ScCommentEditor=O2,X.ScCompactCardList=gC,X.ScConfiguratorsProductInfo=$r,X.ScContragentWithShortInfo=Zu,X.ScCreatorUserTypeTag=Jr,X.ScCuratorSelect=zN,X.ScDateRange=f2,X.ScDateTimeLabel=Ko,X.ScDebouncedInput=G2,X.ScDebouncedInputNumber=Q2,X.ScDebt=g2,X.ScDialogHeader=k2,X.ScDynamicConfigurator=qu,X.ScEmail=Iw,X.ScExternalLink=fC,X.ScImageGallery=rc,X.ScInlineEditableItem=yf,X.ScInlineView=Pa,X.ScKozyrekConfigurator=Eu,X.ScKozyrekConfiguratorParamsForm=lc,X.ScKozyrekConfiguratorPreview=Tu,X.ScKozyrekConfiguratorTemplates=Nu,X.ScKpiGrid=oC,X.ScLightGallery=ic,X.ScManagerOperatorSelect=LN,X.ScManagerSelect=WN,X.ScMetalForDoorsConfigurator=zu,X.ScMetalForDoorsConfiguratorForm=Ou,X.ScMosquitoConfigurator=Fu,X.ScMosquitoConfiguratorForm=Ru,X.ScMosquitoConfiguratorMeasurementInstructions=Pu,X.ScMosquitoConfiguratorPreview=Ea,X.ScOrderColorSwatch=gl,X.ScOrderCommonInfo=am,X.ScOrderDeliveryLabel=gs,X.ScOrderDetails=fm,X.ScOrderExternalLinks=hm,X.ScOrderHighlightSettings=yN,X.ScOrderInfo=mm,X.ScOrderItemParams=ml,X.ScOrderItemsList=dm,X.ScOrderPayment=pl,X.ScOrderProductInfo=lm,X.ScOrderStatusHistory=um,X.ScOrderStatusTag=cm,X.ScOrdersList=q4,X.ScOrgSuggestion=bT,X.ScOrgSuggestionLabel=wm,X.ScPage=gm,X.ScPageWithSlidingPanel=AN,X.ScPersonContactsBlock=Bx,X.ScPhone=sx,X.ScPhoneInput=tC,X.ScProductInfoContent=Rs,X.ScProductInfoDialog=oc,X.ScProductInfoPopover=sc,X.ScProductName=Tr,X.ScProductsList=j5,X.ScReferenceSelect=Gu,X.ScSandwichConfigurator=Hu,X.ScSandwichConfiguratorForm=Lu,X.ScSandwichM2Configurator=ju,X.ScSandwichM2ConfiguratorForm=Wu,X.ScSearchableProductSelect=sm,X.ScSearchableReferenceSelect=om,X.ScSetClientPriceFormItem=gw,X.ScShortTextOrderInfo=xN,X.ScSingleFileUploadSelector=W2,X.ScSlidingContentWithDrawer=ym,X.ScStripConfigurator=Au,X.ScStripConfiguratorForm=Mu,X.ScStripConfiguratorLineItem=Vu,X.ScStripConfiguratorPreview=Iu,X.ScUserShortInfo=yl,X.ScWarningIcon=U2,X.SelectOptionHelper=_t,X.UiNotificationProvider=Cr,X.Validators=He,X.WindowResolutionEnum=je,X.WindowResolutionProvider=Xe,X.channelPrimaryInterestOptionsList=rN,X.componentSizeInjectionKey=Br,X.copyToClipboard=Ol,X.deliveryTypeReferenceList=X4,X.getOrderMarkerColors=Sr,X.getOrderMarkerName=Bs,X.getOrderMarkers=Ns,X.getOrderStatusColors=wi,X.getOrderStatusCssVariables=jl,X.getOrderStatusTagColor=Wl,X.getProductInfoFiles=Ts,X.handleFloatInput=ao,X.handleIntegerInput=lt,X.hasProductInfo=Kl,X.isCanSandwichM2Show=Tx,X.isCanSandwichShow=Yu,X.isConfiguratorType=Xu,X.managersReferenceList=Y4,X.naiveUiTheme=Tp,X.operatorReferenceList=iN,X.opfReferenceList=U4,X.orderStatusDetailReferenceList=nN,X.orderStatusReferenceList=pm,X.paginationItemsPrefix=Ul,X.parse=ct,X.partnerGroupReferenceList=K4,X.paymentTypeReferenceList=tN,X.priceCoefficientsReferenceList=G4,X.productFilesTypesReferenceList=Z4,X.renderConfig=Ye,X.resetInputValidation=ot,X.resourceReferencesList=Q4,X.salesDirectionsReferenceList=J4,X.searchCityReferenceDataHandler=sN,X.searchCityReferenceLabelRenderer=aN,X.searchClientReferenceDataHandler=lN,X.searchClientReferenceLabelRenderer=cN,X.selectAllTextOnFocus=Le,X.showAppVersion=Vm,X.sourcePrimaryInterestOptionsList=oN,X.useCompactLayout=Rm,X.useHoverSupport=Yl,X.vCopy=zl,X.vFocusNext=oi,X.warehousesReferenceList=eN,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})}));
|
|
822
|
+
`,[em({originalTransition:"background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)"})])]);function ps(n){return n.type==="group"}function rm(n){return n.type==="ignored"}function hl(n,e){try{return!!(1+e.toString().toLowerCase().indexOf(n.trim().toLowerCase()))}catch{return!1}}function E5(n,e){return{getIsGroup:ps,getIgnored:rm,getKey(r){return ps(r)?r.name||r.key||"key-required":r[n]},getChildren(r){return r[e]}}}function R5(n,e,i,r){if(!e)return n;function o(s){if(!Array.isArray(s))return[];const a=[];for(const l of s)if(ps(l)){const c=o(l[r]);c.length&&a.push(Object.assign({},l,{[r]:c}))}else{if(rm(l))continue;e(i,l)&&a.push(l)}return a}return o(n)}function P5(n,e,i){const r=new Map;return n.forEach(o=>{ps(o)?o[i].forEach(s=>{r.set(s[e],s)}):r.set(o[e],o)}),r}var F5={};const V5=Object.assign(Object.assign({},Tt.props),{to:Yn.propTo,bordered:{type:Boolean,default:void 0},clearable:Boolean,clearFilterAfterSelect:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},defaultValue:{type:[String,Number,Array],default:null},keyboard:{type:Boolean,default:!0},value:[String,Number,Array],placeholder:String,menuProps:Object,multiple:Boolean,size:String,menuSize:{type:String},filterable:Boolean,disabled:{type:Boolean,default:void 0},remote:Boolean,loading:Boolean,filter:Function,placement:{type:String,default:"bottom-start"},widthMode:{type:String,default:"trigger"},tag:Boolean,onCreate:Function,fallbackOption:{type:[Function,Boolean],default:void 0},show:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:!0},maxTagCount:[Number,String],ellipsisTagPopoverProps:Object,consistentMenuWidth:{type:Boolean,default:!0},virtualScroll:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},childrenField:{type:String,default:"children"},renderLabel:Function,renderOption:Function,renderTag:Function,"onUpdate:value":[Function,Array],inputProps:Object,nodeProps:Function,ignoreComposition:{type:Boolean,default:!0},showOnFocus:Boolean,onUpdateValue:[Function,Array],onBlur:[Function,Array],onClear:[Function,Array],onFocus:[Function,Array],onScroll:[Function,Array],onSearch:[Function,Array],onUpdateShow:[Function,Array],"onUpdate:show":[Function,Array],displayDirective:{type:String,default:"show"},resetMenuOnOptionsChange:{type:Boolean,default:!0},status:String,showCheckmark:{type:Boolean,default:!0},onChange:[Function,Array],items:Array}),M5=t.defineComponent({name:"Select",props:V5,slots:Object,setup(n){F5.NODE_ENV!=="production"&&t.watchEffect(()=>{n.items!==void 0&&gi("select","`items` is deprecated, please use `options` instead."),n.onChange!==void 0&&gi("select","`on-change` is deprecated, please use `on-update:value` instead.")});const{mergedClsPrefixRef:e,mergedBorderedRef:i,namespaceRef:r,inlineThemeDisabled:o}=Oi(n),s=Tt("Select","-select",$5,T5,n,e),a=t.ref(n.defaultValue),l=t.toRef(n,"value"),c=La(l,a),d=t.ref(!1),u=t.ref(""),f=Rf(n,["items","options"]),h=t.ref([]),p=t.ref([]),m=t.computed(()=>p.value.concat(h.value).concat(f.value)),g=t.computed(()=>{const{filter:H}=n;if(H)return H;const{labelField:Z,valueField:ae}=n;return(me,ye)=>{if(!ye)return!1;const Ce=ye[Z];if(typeof Ce=="string")return hl(me,Ce);const Be=ye[ae];return typeof Be=="string"?hl(me,Be):typeof Be=="number"?hl(me,String(Be)):!1}}),b=t.computed(()=>{if(n.remote)return f.value;{const{value:H}=m,{value:Z}=u;return!Z.length||!n.filterable?H:R5(H,g.value,Z,n.childrenField)}}),y=t.computed(()=>{const{valueField:H,childrenField:Z}=n,ae=E5(H,Z);return av(b.value,ae)}),_=t.computed(()=>P5(m.value,n.valueField,n.childrenField)),k=t.ref(!1),x=La(t.toRef(n,"show"),k),v=t.ref(null),B=t.ref(null),w=t.ref(null),{localeRef:T}=zh("Select"),C=t.computed(()=>{var H;return(H=n.placeholder)!==null&&H!==void 0?H:T.value.placeholder}),$=[],E=t.ref(new Map),I=t.computed(()=>{const{fallbackOption:H}=n;if(H===void 0){const{labelField:Z,valueField:ae}=n;return me=>({[Z]:String(me),[ae]:me})}return H===!1?!1:Z=>Object.assign(H(Z),{value:Z})});function R(H){const Z=n.remote,{value:ae}=E,{value:me}=_,{value:ye}=I,Ce=[];return H.forEach(Be=>{if(me.has(Be))Ce.push(me.get(Be));else if(Z&&ae.has(Be))Ce.push(ae.get(Be));else if(ye){const $e=ye(Be);$e&&Ce.push($e)}}),Ce}const O=t.computed(()=>{if(n.multiple){const{value:H}=c;return Array.isArray(H)?R(H):[]}return null}),U=t.computed(()=>{const{value:H}=c;return!n.multiple&&!Array.isArray(H)?H===null?null:R([H])[0]||null:null}),Q=DS(n),{mergedSizeRef:G,mergedDisabledRef:W,mergedStatusRef:D}=Q;function L(H,Z){const{onChange:ae,"onUpdate:value":me,onUpdateValue:ye}=n,{nTriggerFormChange:Ce,nTriggerFormInput:Be}=Q;ae&&Nt(ae,H,Z),ye&&Nt(ye,H,Z),me&&Nt(me,H,Z),a.value=H,Ce(),Be()}function z(H){const{onBlur:Z}=n,{nTriggerFormBlur:ae}=Q;Z&&Nt(Z,H),ae()}function P(){const{onClear:H}=n;H&&Nt(H)}function q(H){const{onFocus:Z,showOnFocus:ae}=n,{nTriggerFormFocus:me}=Q;Z&&Nt(Z,H),me(),ae&&A()}function K(H){const{onSearch:Z}=n;Z&&Nt(Z,H)}function J(H){const{onScroll:Z}=n;Z&&Nt(Z,H)}function Y(){var H;const{remote:Z,multiple:ae}=n;if(Z){const{value:me}=E;if(ae){const{valueField:ye}=n;(H=O.value)===null||H===void 0||H.forEach(Ce=>{me.set(Ce[ye],Ce)})}else{const ye=U.value;ye&&me.set(ye[n.valueField],ye)}}}function V(H){const{onUpdateShow:Z,"onUpdate:show":ae}=n;Z&&Nt(Z,H),ae&&Nt(ae,H),k.value=H}function A(){W.value||(V(!0),k.value=!0,n.filterable&&it())}function ie(){V(!1)}function ce(){u.value="",p.value=$}const pe=t.ref(!1);function at(){n.filterable&&(pe.value=!0)}function we(){n.filterable&&(pe.value=!1,x.value||ce())}function ke(){W.value||(x.value?n.filterable?it():ie():A())}function kt(H){var Z,ae;!((ae=(Z=w.value)===null||Z===void 0?void 0:Z.selfRef)===null||ae===void 0)&&ae.contains(H.relatedTarget)||(d.value=!1,z(H),ie())}function Ne(H){q(H),d.value=!0}function Jt(){d.value=!0}function wn(H){var Z;!((Z=v.value)===null||Z===void 0)&&Z.$el.contains(H.relatedTarget)||(d.value=!1,z(H),ie())}function Pt(){var H;(H=v.value)===null||H===void 0||H.focus(),ie()}function ni(H){var Z;x.value&&(!((Z=v.value)===null||Z===void 0)&&Z.$el.contains(zr(H))||ie())}function On(H){if(!Array.isArray(H))return[];if(I.value)return Array.from(H);{const{remote:Z}=n,{value:ae}=_;if(Z){const{value:me}=E;return H.filter(ye=>ae.has(ye)||me.has(ye))}else return H.filter(me=>ae.has(me))}}function cn(H){pt(H.rawNode)}function pt(H){if(W.value)return;const{tag:Z,remote:ae,clearFilterAfterSelect:me,valueField:ye}=n;if(Z&&!ae){const{value:Ce}=p,Be=Ce[0]||null;if(Be){const $e=h.value;$e.length?$e.push(Be):h.value=[Be],p.value=$}}if(ae&&E.value.set(H[ye],H),n.multiple){const Ce=On(c.value),Be=Ce.findIndex($e=>$e===H[ye]);if(~Be){if(Ce.splice(Be,1),Z&&!ae){const $e=se(H[ye]);~$e&&(h.value.splice($e,1),me&&(u.value=""))}}else Ce.push(H[ye]),me&&(u.value="");L(Ce,R(Ce))}else{if(Z&&!ae){const Ce=se(H[ye]);~Ce?h.value=[h.value[Ce]]:h.value=$}ii(),ie(),L(H[ye],H)}}function se(H){return h.value.findIndex(ae=>ae[n.valueField]===H)}function de(H){x.value||A();const{value:Z}=H.target;u.value=Z;const{tag:ae,remote:me}=n;if(K(Z),ae&&!me){if(!Z){p.value=$;return}const{onCreate:ye}=n,Ce=ye?ye(Z):{[n.labelField]:Z,[n.valueField]:Z},{valueField:Be,labelField:$e}=n;f.value.some(et=>et[Be]===Ce[Be]||et[$e]===Ce[$e])||h.value.some(et=>et[Be]===Ce[Be]||et[$e]===Ce[$e])?p.value=$:p.value=[Ce]}}function Re(H){H.stopPropagation();const{multiple:Z}=n;!Z&&n.filterable&&ie(),P(),Z?L([],[]):L(null,null)}function qe(H){!Or(H,"action")&&!Or(H,"empty")&&!Or(H,"header")&&H.preventDefault()}function dn(H){J(H)}function Kt(H){var Z,ae,me,ye,Ce;if(!n.keyboard){H.preventDefault();return}switch(H.key){case" ":if(n.filterable)break;H.preventDefault();case"Enter":if(!(!((Z=v.value)===null||Z===void 0)&&Z.isComposing)){if(x.value){const Be=(ae=w.value)===null||ae===void 0?void 0:ae.getPendingTmNode();Be?cn(Be):n.filterable||(ie(),ii())}else if(A(),n.tag&&pe.value){const Be=p.value[0];if(Be){const $e=Be[n.valueField],{value:et}=c;n.multiple&&Array.isArray(et)&&et.includes($e)||pt(Be)}}}H.preventDefault();break;case"ArrowUp":if(H.preventDefault(),n.loading)return;x.value&&((me=w.value)===null||me===void 0||me.prev());break;case"ArrowDown":if(H.preventDefault(),n.loading)return;x.value?(ye=w.value)===null||ye===void 0||ye.next():A();break;case"Escape":x.value&&(IS(H),ie()),(Ce=v.value)===null||Ce===void 0||Ce.focus();break}}function ii(){var H;(H=v.value)===null||H===void 0||H.focus()}function it(){var H;(H=v.value)===null||H===void 0||H.focusInput()}function en(){var H;x.value&&((H=B.value)===null||H===void 0||H.syncPosition())}Y(),t.watch(t.toRef(n,"options"),Y);const br={focus:()=>{var H;(H=v.value)===null||H===void 0||H.focus()},focusInput:()=>{var H;(H=v.value)===null||H===void 0||H.focusInput()},blur:()=>{var H;(H=v.value)===null||H===void 0||H.blur()},blurInput:()=>{var H;(H=v.value)===null||H===void 0||H.blurInput()}},xn=t.computed(()=>{const{self:{menuBoxShadow:H}}=s.value;return{"--n-menu-box-shadow":H}}),ri=o?zi("select",void 0,xn,n):void 0;return Object.assign(Object.assign({},br),{mergedStatus:D,mergedClsPrefix:e,mergedBordered:i,namespace:r,treeMate:y,isMounted:ns(),triggerRef:v,menuRef:w,pattern:u,uncontrolledShow:k,mergedShow:x,adjustedTo:Yn(n),uncontrolledValue:a,mergedValue:c,followerRef:B,localizedPlaceholder:C,selectedOption:U,selectedOptions:O,mergedSize:G,mergedDisabled:W,focused:d,activeWithoutMenuOpen:pe,inlineThemeDisabled:o,onTriggerInputFocus:at,onTriggerInputBlur:we,handleTriggerOrMenuResize:en,handleMenuFocus:Jt,handleMenuBlur:wn,handleMenuTabOut:Pt,handleTriggerClick:ke,handleToggle:cn,handleDeleteOption:pt,handlePatternInput:de,handleClear:Re,handleTriggerBlur:kt,handleTriggerFocus:Ne,handleKeydown:Kt,handleMenuAfterLeave:ce,handleMenuClickOutside:ni,handleMenuScroll:dn,handleMenuKeydown:Kt,handleMenuMousedown:qe,mergedTheme:s,cssVars:o?void 0:xn,themeClass:ri==null?void 0:ri.themeClass,onRender:ri==null?void 0:ri.onRender})},render(){return t.h("div",{class:`${this.mergedClsPrefix}-select`},t.h(Mf,null,{default:()=>[t.h(If,null,{default:()=>t.h(B5,{ref:"triggerRef",inlineThemeDisabled:this.inlineThemeDisabled,status:this.mergedStatus,inputProps:this.inputProps,clsPrefix:this.mergedClsPrefix,showArrow:this.showArrow,maxTagCount:this.maxTagCount,ellipsisTagPopoverProps:this.ellipsisTagPopoverProps,bordered:this.mergedBordered,active:this.activeWithoutMenuOpen||this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,renderTag:this.renderTag,renderLabel:this.renderLabel,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,labelField:this.labelField,valueField:this.valueField,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,loading:this.loading,focused:this.focused,onClick:this.handleTriggerClick,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onClear:this.handleClear,onBlur:this.handleTriggerBlur,onFocus:this.handleTriggerFocus,onKeydown:this.handleKeydown,onPatternBlur:this.onTriggerInputBlur,onPatternFocus:this.onTriggerInputFocus,onResize:this.handleTriggerOrMenuResize,ignoreComposition:this.ignoreComposition},{arrow:()=>{var n,e;return[(e=(n=this.$slots).arrow)===null||e===void 0?void 0:e.call(n)]}})}),t.h(Zf,{ref:"followerRef",show:this.mergedShow,to:this.adjustedTo,teleportDisabled:this.adjustedTo===Yn.tdkey,containerClass:this.namespace,width:this.consistentMenuWidth?"target":void 0,minWidth:"target",placement:this.placement},{default:()=>t.h(t.Transition,{name:"fade-in-scale-up-transition",appear:this.isMounted,onAfterLeave:this.handleMenuAfterLeave},{default:()=>{var n,e,i;return this.mergedShow||this.displayDirective==="show"?((n=this.onRender)===null||n===void 0||n.call(this),t.withDirectives(t.h(t5,Object.assign({},this.menuProps,{ref:"menuRef",onResize:this.handleTriggerOrMenuResize,inlineThemeDisabled:this.inlineThemeDisabled,virtualScroll:this.consistentMenuWidth&&this.virtualScroll,class:[`${this.mergedClsPrefix}-select-menu`,this.themeClass,(e=this.menuProps)===null||e===void 0?void 0:e.class],clsPrefix:this.mergedClsPrefix,focusable:!0,labelField:this.labelField,valueField:this.valueField,autoPending:!0,nodeProps:this.nodeProps,theme:this.mergedTheme.peers.InternalSelectMenu,themeOverrides:this.mergedTheme.peerOverrides.InternalSelectMenu,treeMate:this.treeMate,multiple:this.multiple,size:this.menuSize,renderOption:this.renderOption,renderLabel:this.renderLabel,value:this.mergedValue,style:[(i=this.menuProps)===null||i===void 0?void 0:i.style,this.cssVars],onToggle:this.handleToggle,onScroll:this.handleMenuScroll,onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onTabOut:this.handleMenuTabOut,onMousedown:this.handleMenuMousedown,show:this.mergedShow,showCheckmark:this.showCheckmark,resetMenuOnOptionsChange:this.resetMenuOnOptionsChange}),{empty:()=>{var r,o;return[(o=(r=this.$slots).empty)===null||o===void 0?void 0:o.call(r)]},header:()=>{var r,o;return[(o=(r=this.$slots).header)===null||o===void 0?void 0:o.call(r)]},action:()=>{var r,o;return[(o=(r=this.$slots).action)===null||o===void 0?void 0:o.call(r)]}}),this.displayDirective==="show"?[[t.vShow,this.mergedShow],[ts,this.handleMenuClickOutside,void 0,{capture:!0}]]:[[ts,this.handleMenuClickOutside,void 0,{capture:!0}]])):null}})})]}))}}),I5={},om=t.defineComponent({...I5,__name:"searchable-reference-select",props:{searchDataHandler:{},optionsListConverter:{},renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=t.computed(()=>s.value?r.value.map(_=>_.id):r.value?r.value.id:null),l=t.ref(s.value?r.optionsListConverter(r.value):r.value?r.optionsListConverter([r.value]):[]);t.watch(()=>r.value,_=>{const x=(M.isArray(_)?_:_?[_]:[]).filter(v=>!l.value.some(B=>B.value===v.id));x.length>0&&(l.value=[...r.optionsListConverter(x),...l.value])},{deep:1});const c=t.computed(()=>l.value.map(_=>({..._,class:r.wrapContent?`${_.class} consistent-menu-width`:_.class}))),d=t.ref(!1),u=t.useTemplateRef("select-component"),f=_=>{_.length<r.minTermLength||(d.value=!0,r.searchDataHandler(_,d).then(k=>{if(M.isEmpty(k))return;const x=s.value?r.value:r.value?[r.value]:[],v=k.filter(B=>!x.some(w=>w.id===B.id));l.value=r.optionsListConverter([...x,...v])}).finally(()=>{d.value=!1}))};let h="";const p=M.debounce(()=>f(h),800),m=_=>{h=_,p()},g=_=>{var k;if(M.isArray(_)){const x=_.length>0?_.map(v=>{var B;return t.toRaw((B=l.value.find(w=>w.value===v))==null?void 0:B.item)}):[];o("update:value",x)}else if(_>0){const x=t.toRaw((k=l.value.find(v=>v.value===_))==null?void 0:k.item);o("update:value",x)}else o("update:value",null)};return e({focus:()=>{var _;return(_=u.value)==null?void 0:_.focusInput()},blur:()=>{var _;return(_=u.value)==null?void 0:_.blurInput()}}),(_,k)=>(t.openBlock(),t.createBlock(t.unref(M5),{ref:"select-component","clear-filter-after-select":!0,clearable:n.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled,filterable:!0,loading:d.value,multiple:s.value,options:c.value,placeholder:n.placeholder,remote:!0,value:a.value,"render-label":n.renderLabel,"render-tag":n.renderTag,onSearch:m,"onUpdate:value":g},null,8,["clearable","consistent-menu-width","disabled","loading","multiple","options","placeholder","value","render-label","render-tag"]))}}),A5={},sm=t.defineComponent({...A5,__name:"searchable-product-select",props:{renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""},searchType:{}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useTemplateRef("select-component"),a=async f=>r.searchType==="categories"?j.HttpRequester.getInstance(j.ProductCategoryDataProvider).publicSimpleSearch(f):r.searchType==="products"?j.HttpRequester.getInstance(j.ProductDataProvider).publicSimpleSearch(f):new Promise(h=>{h([])}),l=f=>r.searchType==="categories"?gt.convertReferencesToSelectOptionsList(f,!0,!1,!1,h=>h!=null&&h.isNewRec()?"-":h.name):r.searchType==="products"?gt.convertReferencesToSelectOptionsList(f,!0,!1,!1,h=>h!=null&&h.isNewRec()?"-":`[${h.code}] ${h.name}`):[],c=(f,h)=>{if(r.renderLabel)return r.renderLabel(f,h);if(r.searchType==="products"){const p=f.item;return t.h("div",{},[t.h("span",{class:"text-sc-grey mr-2.5"},p.code),t.h("span",{},[p.name])])}if(r.searchType==="categories"){const p=f.item;return t.h("div",{},[p.name])}};return e({focus:()=>{var f;return(f=s.value)==null?void 0:f.focus()},blur:()=>{var f;return(f=s.value)==null?void 0:f.blur()}}),(f,h)=>(t.openBlock(),t.createBlock(om,{ref:"select-component",value:n.value,clearable:n.clearable,disabled:n.disabled,placeholder:n.placeholder,"search-data-handler":a,"options-list-converter":l,"consistent-menu-width":n.consistentMenuWidth,"wrap-content":n.wrapContent,"min-term-length":n.minTermLength,"render-label":c,"render-tag":n.renderTag,"onUpdate:value":h[0]||(h[0]=p=>o("update:value",p))},null,8,["value","clearable","disabled","placeholder","consistent-menu-width","wrap-content","min-term-length","render-tag"]))}}),O5={class:"col-span-2 flex flex-row gap-2.5"},z5={class:"flex-1"},D5={class:"text-sc-grey"},L5={class:"ml-2.5"},H5={key:0,class:"flex-none"},W5={},j5=t.defineComponent({...W5,__name:"products-list",props:{value:{},searchType:{},minTermLength:{default:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},disabled:{type:Boolean}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(null),s=()=>structuredClone(t.toRaw(i.value)),a=t.ref(s()),l=()=>{r("update:value",a.value.map(f=>t.toRaw(f)))},c=f=>{f&&(a.value=[...a.value.map(h=>t.toRaw(h)),...(M.isArray(f)?f:[f]).filter(h=>!a.value.some(p=>p.id===h.id))],t.nextTick(()=>{o.value=null}),l())},d=f=>{f&&(a.value=a.value.map(h=>h.id===f.id?f:t.toRaw(h)),l())},u=f=>{a.value=a.value.filter(h=>h.id!==f.id),l()};return t.watch(()=>i.value,()=>{a.value=s()}),(f,h)=>{const p=F.NListItem,m=_C,g=F.NButton,b=F.NList;return t.openBlock(),t.createBlock(b,{"show-divider":!1,hoverable:!0},{header:t.withCtx(()=>[t.renderSlot(f.$slots,"header")]),footer:t.withCtx(()=>[t.createVNode(sm,{value:o.value,"onUpdate:value":[h[0]||(h[0]=y=>o.value=y),c],clearable:!0,disabled:n.disabled,"min-term-length":n.minTermLength,"search-type":n.searchType,placeholder:"Введите название"},null,8,["value","disabled","min-term-length","search-type"])]),default:t.withCtx(()=>[a.value.length===0?(t.openBlock(),t.createBlock(p,{key:0,class:"text-center text-sm text-gray-600"},{default:t.withCtx(()=>[...h[1]||(h[1]=[t.createTextVNode(" --- Список пуст --- ",-1)])]),_:1})):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,y=>(t.openBlock(),t.createBlock(p,{key:y.id},{suffix:t.withCtx(()=>[t.createVNode(g,{disabled:n.disabled,quaternary:"",type:"error",onClick:_=>u(y)},{default:t.withCtx(()=>[t.createVNode(m)]),_:1},8,["disabled","onClick"])]),default:t.withCtx(()=>[t.createElementVNode("div",O5,[t.createElementVNode("span",z5,[t.createElementVNode("span",D5,t.toDisplayString(y.code),1),t.createElementVNode("span",L5,t.toDisplayString(y.name),1)]),f.$slots["item-extra"]?(t.openBlock(),t.createElementBlock("div",H5,[t.renderSlot(f.$slots,"item-extra",{item:y,updateItemCallback:d})])):t.createCommentVNode("",!0)])]),_:2},1024))),128))]),_:3})}}}),q5={class:"flex flex-col"},X5={class:"flex flex-col gap-1.5 text-base text-nowrap"},Y5={class:"font-medium"},U5={class:"flex flex-col text-sc-dark-grey"},K5={key:0},G5={class:"font-medium"},Z5={class:"font-medium"},Q5={class:"font-medium"},J5={class:"font-medium"},e3={class:"font-medium"},t3={class:"font-medium"},n3={class:"font-medium"},i3={class:"font-medium"},r3={class:"font-medium"},o3={class:"font-medium"},s3={class:"flex flex-col gap-1.5 text-base text-nowrap"},a3={class:"font-medium"},l3={class:"flex flex-col text-sc-dark-grey"},c3={class:"font-medium"},d3={class:"font-medium"},u3={class:"flex flex-col gap-1.5 text-base text-nowrap"},f3={class:"font-medium"},h3={class:"text-sc-dark-grey"},m3={class:"font-medium"},p3={key:1,class:"text-base font-medium text-nowrap"},g3={},ml=t.defineComponent({...g3,__name:"order-item-params",props:{item:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},updateQuantityOnInput:{type:Boolean,default:!0}},setup(n){const e=[j.ConfiguratorsEnum.Kozyrek,j.ConfiguratorsEnum.Mosquitto,j.ConfiguratorsEnum.Strip,j.ConfiguratorsEnum.MetalForDoors,j.ConfiguratorsEnum.Sandwich,j.ConfiguratorsEnum.SandwichM2],i=n,r=t.ref(!1),o=t.computed(()=>i.item),s=t.computed(()=>{var p,m;return((p=i.item.product.unit)==null?void 0:p.isLinear)&&((m=i.item.product.properties)==null?void 0:m.isLengthConfigurator)}),a=t.computed(()=>j.UnitsHelper.getProductLengthMultiplicity(i.item.product)),l=t.computed(()=>j.UnitsHelper.getProductMultiplicity(i.item.product)),c=t.computed(()=>l.value>1),d=t.ref({quantity:i.item.quantity});t.watch(()=>i.item,p=>{d.value={quantity:p.quantity}});const u=p=>{var m;p!==null&&(d.value.quantity=p,(m=i.eventEmitter)==null||m.emit("order-item:edit-quantity",{item:o.value,quantity:p,loaderRef:r}))},f=()=>{var p;(p=i.eventEmitter)==null||p.emit("order-item:open-configurator",{item:o.value})},h=()=>{var p;(p=i.eventEmitter)==null||p.emit("order-item:edit",{item:o.value})};return(p,m)=>{const g=F.NInputNumber;return t.openBlock(),t.createElementBlock("div",q5,[n.item.configurator&&n.item.configuratorParams&&e.includes(n.item.configurator)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",X5,[t.createElementVNode("span",null,[m[1]||(m[1]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",Y5,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("div",U5,[n.item.configurator===t.unref(j.ConfiguratorsEnum).Kozyrek?(t.openBlock(),t.createElementBlock("span",K5,[m[2]||(m[2]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",G5,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])):t.createCommentVNode("",!0),n.item.configurator===t.unref(j.ConfiguratorsEnum).Mosquitto?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("span",null,[m[3]||(m[3]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",Z5,t.toDisplayString(Math.round(n.item.width*1e3))+" мм.",1)]),t.createElementVNode("span",null,[m[4]||(m[4]=t.createTextVNode(" Высота: ",-1)),t.createElementVNode("span",Q5,t.toDisplayString(Math.round(n.item.height*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(j.ConfiguratorsEnum).Strip?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.item.configuratorParams.linesWidths,(b,y)=>(t.openBlock(),t.createElementBlock("span",{key:y},[t.createTextVNode(" Полоса №"+t.toDisplayString(Number(y)+1)+": ",1),t.createElementVNode("span",J5,t.toDisplayString(b)+" мм.",1)]))),128)),t.createElementVNode("span",null,[m[5]||(m[5]=t.createTextVNode(" Метраж: ",-1)),t.createElementVNode("span",e3,t.toDisplayString(n.item.length)+" м.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(j.ConfiguratorsEnum).MetalForDoors?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("span",null,[m[6]||(m[6]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",t3,t.toDisplayString(n.item.width)+" мм.",1)]),t.createElementVNode("span",null,[m[7]||(m[7]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",n3,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(j.ConfiguratorsEnum).Sandwich?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:4},t.renderList(n.item.configuratorParams.items??[],(b,y)=>(t.openBlock(),t.createElementBlock("span",{key:y},[t.createTextVNode(" Изделие №"+t.toDisplayString(Number(y)+1)+": ",1),t.createElementVNode("span",i3,t.toDisplayString(b.width)+"×"+t.toDisplayString(b.length)+" мм, "+t.toDisplayString(b.count)+" шт.",1)]))),128)):t.createCommentVNode("",!0),n.item.configurator===t.unref(j.ConfiguratorsEnum).SandwichM2?(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[t.createElementVNode("span",null,[m[8]||(m[8]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",r3,t.toDisplayString(Math.round(n.item.width*1e3))+" мм.",1)]),t.createElementVNode("span",null,[m[9]||(m[9]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",o3,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0)])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(f,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):s.value&&a.value>0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",s3,[t.createElementVNode("span",null,[m[10]||(m[10]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",a3,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("div",l3,[t.createElementVNode("span",null,[m[11]||(m[11]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",c3,t.toDisplayString(a.value)+" "+t.toDisplayString(n.item.product.unit.name),1)]),t.createElementVNode("span",null,[m[12]||(m[12]=t.createTextVNode(" Всего: ",-1)),t.createElementVNode("span",d3,t.toDisplayString(n.item.quantity*a.value)+" "+t.toDisplayString(n.item.product.unit.name),1)])])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(h,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):n.item.product.getIsMeasurable()?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",u3,[t.createElementVNode("span",null,[m[13]||(m[13]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",f3,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("span",h3,[m[14]||(m[14]=t.createTextVNode(" Метраж: ",-1)),t.createElementVNode("span",m3,t.toDisplayString(n.item.length??n.item.width)+" "+t.toDisplayString(n.item.product.unit.name),1)])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(h,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[n.allowEdit?(t.openBlock(),t.createBlock(g,{key:0,value:d.value.quantity,parse:t.unref(ct),min:l.value,step:l.value,"show-button":c.value,"button-placement":"both","update-value-on-input":n.updateQuantityOnInput,disabled:!!r.value,loading:!!r.value,placeholder:"Кол-во",size:"small",class:"min-w-16 grow",onKeydown:m[0]||(m[0]=b=>t.unref(ao)(b,".",!1)),onFocus:t.unref(Le),"onUpdate:value":u},{suffix:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.item.product.unit.name),1)]),_:1},8,["value","parse","min","step","show-button","update-value-on-input","disabled","loading","onFocus"])):(t.openBlock(),t.createElementBlock("span",p3,t.toDisplayString(n.item.quantity)+" "+t.toDisplayString(n.item.product.unit.name),1))],64))])}}}),y3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function b3(n,e){return t.openBlock(),t.createElementBlock("svg",y3,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M13 4a1 1 0 0 1 1 1h4a1 1 0 0 1 .783.378l.074.108l3 5l.055.103l.04.107l.029.109l.016.11L22 11v6a1 1 0 0 1-1 1h-1.171a3.001 3.001 0 0 1-5.658 0H9.829a3.001 3.001 0 0 1-5.658 0H3a1 1 0 0 1-1-1V6a2 2 0 0 1 2-2zM7 16a1 1 0 1 0 0 2a1 1 0 0 0 0-2m10 0a1 1 0 1 0 0 2a1 1 0 0 0 0-2m.434-9H14v3h5.234z"},null,-1)])])}const _3=t.markRaw({name:"tabler-truck-filled",render:b3}),w3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function x3(n,e){return t.openBlock(),t.createElementBlock("svg",w3,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M5 17a2 2 0 1 0 4 0a2 2 0 1 0-4 0m10 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"}),t.createElementVNode("path",{d:"M5 17H3v-4M2 5h11v12m-4 0h6m4 0h2v-6h-8m0-5h5l3 5M3 9h4"})],-1)])])}const k3=t.markRaw({name:"tabler-truck-delivery",render:x3}),C3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function v3(n,e){return t.openBlock(),t.createElementBlock("svg",C3,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M2 3h1a2 2 0 0 1 2 2v10a2 2 0 0 0 2 2h15"}),t.createElementVNode("path",{d:"M9 9a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-4a3 3 0 0 1-3-3zM7 19a2 2 0 1 0 4 0a2 2 0 1 0-4 0m9 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"})],-1)])])}const S3=t.markRaw({name:"tabler-truck-loading",render:v3}),B3={class:"flex flex-col gap-1"},N3={key:0,class:"flex flex-row gap-1 text-sm text-sc-grey"},T3={key:1,class:"text-base"},$3={class:"text-sc-dark-grey mr-1.5"},E3={key:0},R3={key:1},P3={},gs=t.defineComponent({...P3,__name:"order-delivery-label",props:{delivery:{},showType:{type:Boolean,default:!0},showDetails:{type:Boolean,default:!0}},setup(n){const e=t.computed(()=>{var s;return(s=j.useReferencesStore().deliveryTypeReference)==null?void 0:s.find(a=>a.id===o.delivery.type)}),i=t.computed(()=>xe.format(o.delivery.date,"dd.MM.yyyy")),r=t.computed(()=>{var s;return(s=o.delivery.address)!=null&&s.address?si.getFormatEntityName({name:o.delivery.address.address,deletedAt:o.delivery.address.deletedAt}):""}),o=n;return(s,a)=>{var u,f,h,p,m,g,b,y;const l=S3,c=k3,d=_3;return t.openBlock(),t.createElementBlock("div",B3,[n.showType?(t.openBlock(),t.createElementBlock("span",N3,[((u=e.value)==null?void 0:u.slug)==="self_delivery"?(t.openBlock(),t.createBlock(l,{key:0})):t.createCommentVNode("",!0),((f=e.value)==null?void 0:f.slug)==="delivery"?(t.openBlock(),t.createBlock(c,{key:1})):t.createCommentVNode("",!0),((h=e.value)==null?void 0:h.slug)==="transport_company_delivery"?(t.openBlock(),t.createBlock(d,{key:2})):t.createCommentVNode("",!0),t.createElementVNode("span",null,t.toDisplayString((p=e.value)==null?void 0:p.name),1)])):t.createCommentVNode("",!0),n.showDetails?(t.openBlock(),t.createElementBlock("span",T3,[t.createElementVNode("span",$3,t.toDisplayString(i.value),1),(g=(m=n.delivery)==null?void 0:m.address)!=null&&g.address?(t.openBlock(),t.createElementBlock("span",E3,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0),(y=(b=n.delivery)==null?void 0:b.warehouse)!=null&&y.address?(t.openBlock(),t.createElementBlock("span",R3," со склада "+t.toDisplayString(n.delivery.warehouse.address),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])}}}),F3={class:"flex flex-col gap-2.5"},V3={class:"text-base"},M3=["href"],I3={key:1,class:"text-sc-grey"},A3={},am=t.defineComponent({...A3,__name:"order-common-info",props:{order:{},eventEmitter:{},allowEdit:{type:Boolean},fields:{},showAttachedUserColumn:{type:Boolean},orderContextButtonsConfig:{type:Function},onOrderContextSelect:{type:Function},orderUrl:{},highlightSettings:{}},setup(n){const e=n,i=t.computed(()=>e.fields.includes(Me.Id)?e.order.id:void 0),r=t.computed(()=>{var f,h;return e.fields.includes(Me.Status)?(h=(f=j.useReferencesStore().orderStatusReference)==null?void 0:f.find(p=>{var m;return p.id===(((m=e.order.status)==null?void 0:m.id)??-1)}))==null?void 0:h.name:void 0}),o=t.computed(()=>{var f;return wi((f=e.order.status)==null?void 0:f.slug)}),s=t.computed(()=>{var h,p;const f=(h=e.order.status)==null?void 0:h.slug;return!!f&&(((p=e.highlightSettings)==null?void 0:p.statuses.includes(f))??!1)}),a=t.computed(()=>Ns(e.order).filter(f=>[rt.OnOrder,rt.NotInStock].includes(f))),l=f=>{var h;return((h=e.highlightSettings)==null?void 0:h.markers.includes(f))??!1},c=t.computed(()=>e.fields.includes(Me.CreatedAt)),d=t.computed(()=>e.fields.includes(Me.ClientInfo)||e.fields.includes(Me.ClientInfoShort)?e.order.client:void 0),u=t.computed(()=>e.fields.includes(Me.DeliveryInfo)?e.order.delivery:void 0);return(f,h)=>(t.openBlock(),t.createElementBlock("div",F3,[t.createElementVNode("span",V3,[i.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:n.orderUrl.replace(":id",n.order.id.toString()),target:"_blank",class:"text-sc-dark-grey"}," #"+t.toDisplayString(i.value),9,M3)):t.createCommentVNode("",!0),c.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[h[0]||(h[0]=t.createTextVNode(" от ",-1)),t.createVNode(Ko,{date:n.order.createdAt,"is-time-secondary":!0},null,8,["date"])],64)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[h[1]||(h[1]=t.createTextVNode(" - ",-1)),s.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"font-medium",style:t.normalizeStyle({color:o.value.color})},t.toDisplayString(r.value),5)):(t.openBlock(),t.createElementBlock("span",I3,t.toDisplayString(r.value),1))],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,p=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:p},[h[2]||(h[2]=t.createTextVNode(" - ",-1)),t.createElementVNode("span",{class:t.normalizeClass({"font-medium":l(p),"text-sc-dark-grey":!l(p)}),style:t.normalizeStyle(l(p)?{color:t.unref(Sr)(p).color}:void 0)},t.toDisplayString(t.unref(Bs)(p)),7)],64))),128))]),d.value?(t.openBlock(),t.createBlock(Ir,{key:0,client:d.value,class:"ml-3"},null,8,["client"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createBlock(gs,{key:1,delivery:u.value,class:"ml-3"},null,8,["delivery"])):t.createCommentVNode("",!0)]))}}),O3={},pl=t.defineComponent({...O3,__name:"order-payment",props:{payment:{}},setup(n){const e=n,i=t.computed(()=>{var r;return(r=j.useReferencesStore().paymentTypeReference)==null?void 0:r.find(o=>o.id===e.payment.type)});return(r,o)=>{var s;return t.openBlock(),t.createElementBlock("span",null,t.toDisplayString(((s=i.value)==null?void 0:s.name)??"-"),1)}}}),z3={},Jr=t.defineComponent({...z3,__name:"creator-user-type-tag",props:{userType:{default:void 0},prefixText:{default:"Добавлено"},variant:{default:"info"},changedFields:{default:void 0}},setup(n){const e=n,i={quantity:"количество",length:"длина"},r=t.computed(()=>e.variant==="danger"||e.changedFields?"bg-orange-500":"bg-sky-500"),o=t.computed(()=>{const s={[j.UserTypeEnum.Manager]:"менеджером",[j.UserTypeEnum.Operator]:"оператором",[j.UserTypeEnum.Client]:"клиентом",[j.UserTypeEnum.Admin]:"администратором"};if(e.changedFields){const l=e.changedFields.map(d=>i[d]??d).join(", ");return`Было изменено${e.userType?` ${s[e.userType]??""}`:""}: ${l}`}const a=e.userType?` ${s[e.userType]??""}`:"";return`${e.prefixText}${a}`.trim()});return(s,a)=>(t.openBlock(),t.createElementBlock("small",{class:t.normalizeClass(`inline-block py-[0.0625rem] px-1.5 text-xs font-bold text-center whitespace-nowrap rounded text-white no-underline opacity-100 ${r.value}`)},t.toDisplayString(o.value),3))}}),D3={class:"flex flex-row gap-1.5"},L3={class:"flex-none text-nowrap"},H3={class:"flex flex-1 flex-col gap-2.5"},W3={key:0,class:"text-sm"},j3={class:"text-gray-600"},q3={key:2,class:"flex items-start gap-1"},X3={class:"grid grid-flow-col grid-rows-2 gap-1 text-base"},Y3={key:0},U3={key:1},K3={},lm=t.defineComponent({...K3,__name:"order-product-info",props:{product:{},index:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},updateQuantityOnInput:{type:Boolean,default:!0}},setup(n){const e=t.inject(j.currentOrderInjectionKey,null),i=t.computed(()=>{if(e!=null)return t.toValue(e)??void 0});return(r,o)=>{var s;return t.openBlock(),t.createElementBlock("div",D3,[t.createElementVNode("span",L3,t.toDisplayString(n.index+1)+".",1),t.createElementVNode("div",H3,[t.createVNode(Tr,{product:n.product.product},null,8,["product"]),n.product.marker?(t.openBlock(),t.createElementBlock("span",W3,[o[0]||(o[0]=t.createTextVNode(" Маркировка: ",-1)),t.createElementVNode("span",j3,t.toDisplayString(n.product.marker),1)])):t.createCommentVNode("",!0),n.product.creator&&(!i.value||((s=i.value)==null?void 0:s.creator.guid)!==n.product.creator.guid)&&n.product.creator.type?(t.openBlock(),t.createBlock(Jr,{key:1,"user-type":n.product.creator.type,class:"self-start"},null,8,["user-type"])):t.createCommentVNode("",!0),n.allowEdit?(t.openBlock(),t.createElementBlock("div",q3,[t.createVNode(ml,{item:n.product,"event-emitter":n.eventEmitter,"allow-edit":n.allowEdit,"update-quantity-on-input":n.updateQuantityOnInput,class:"min-w-0 flex-1"},null,8,["item","event-emitter","allow-edit","update-quantity-on-input"]),t.renderSlot(r.$slots,"actions")])):t.createCommentVNode("",!0),t.createElementVNode("div",X3,[n.allowEdit?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o[1]||(o[1]=t.createElementVNode("span",null,"Кол-во",-1)),n.product.product.getIsMeasurable()?(t.openBlock(),t.createElementBlock("span",Y3,t.toDisplayString(`${n.product.length} ${n.product.product.unit.name} x ${n.product.quantity} шт.`),1)):(t.openBlock(),t.createElementBlock("span",U3,t.toDisplayString(`${n.product.quantity} ${n.product.product.unit.name}`),1))],64)),o[2]||(o[2]=t.createElementVNode("span",null,"Цена за ед.",-1)),t.createVNode(ai,{product:n.product,"cost-field-name":"costOneRub"},null,8,["product"]),o[3]||(o[3]=t.createElementVNode("span",null,"Сумма",-1)),t.createVNode(ai,{product:n.product,"cost-field-name":"cost"},null,8,["product"])])])])}}}),G3={class:"flex items-center gap-1.5"},Z3={key:0,class:"h-1.5 w-1.5 shrink-0 rounded-full bg-current"},Q3={key:0,class:"h-1.5 w-1.5 shrink-0 rounded-full bg-current"},J3={},cm=t.defineComponent({...J3,__name:"order-status-tag",props:{status:{},statusDetail:{default:null},variant:{default:"filled"},size:{default:"medium"},showDot:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>wi(e.status.slug)),r=t.computed(()=>Wl(e.status.slug)),o=t.computed(()=>e.statusDetail?`${e.status.name} (${e.statusDetail.name})`:e.status.name);return(s,a)=>{const l=F.NTag;return n.variant==="filled"?(t.openBlock(),t.createBlock(l,{key:0,color:r.value,bordered:!1,size:n.size,round:""},{default:t.withCtx(()=>[t.createElementVNode("span",G3,[n.showDot?(t.openBlock(),t.createElementBlock("span",Z3)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)])]),_:1},8,["color","size"])):(t.openBlock(),t.createElementBlock("span",{key:1,class:"inline-flex items-center gap-1.5 font-medium",style:t.normalizeStyle({color:i.value.color})},[n.showDot?(t.openBlock(),t.createElementBlock("span",Q3)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)],4))}}}),e4={},gl=t.defineComponent({...e4,__name:"order-color-swatch",props:{colors:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("span",{class:"inline-flex h-5 min-w-8 shrink-0 items-center justify-center rounded px-1.5 text-xs font-semibold leading-none",style:t.normalizeStyle({backgroundColor:n.colors.backgroundColor,color:n.colors.textOnBackgroundColor,border:`1px solid ${n.colors.color}`})}," Аа ",4))}}),t4={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function n4(n,e){return t.openBlock(),t.createElementBlock("svg",t4,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m112 112l20 320c.95 18.49 14.4 32 32 32h184c17.67 0 30.87-13.51 32-32l20-320"},null,-1),t.createElementVNode("path",{fill:"currentColor",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32",d:"M80 112h352"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 112V72h0a23.93 23.93 0 0 1 24-24h80a23.93 23.93 0 0 1 24 24h0v40m-64 64v224m-72-224l8 224m136-224l-8 224"},null,-1)])])}const i4=t.markRaw({name:"ion-trash-outline",render:n4}),r4={},o4=t.defineComponent({...r4,__name:"order-item-specification",props:{src:{}},setup(n){const e=t.useTemplateRef("image-reference");return(i,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("a",{class:"text-blue-500 hover:underline text-sm mt-1 block cursor-pointer",onClick:r[0]||(r[0]=o=>{var s;return(s=e.value)==null?void 0:s.showPreview()})}," Спецификация "),t.withDirectives(t.createVNode(t.unref(F.NImage),{ref:"image-reference",src:n.src,"previewed-img-props":{style:"max-width: 80vw; max-height: 80vh; object-fit: contain; border: 12px solid white;"}},null,8,["src"]),[[t.vShow,!1]])],64))}}),s4={class:"flex flex-col gap-0.5"},a4={class:"text-gray-600"},l4={},c4=t.defineComponent({...l4,__name:"order-item-name",props:{item:{}},setup(n){const e=n,i=t.inject(j.currentOrderInjectionKey,null),r=t.computed(()=>{if(i!=null)return t.toValue(i)??void 0}),o=t.computed(()=>!!e.item.isRemoved||!!e.item.replacementId),s=t.computed(()=>{var d;return"creator"in e.item&&!!((d=e.item.creator)!=null&&d.type)&&(!r.value||r.value.creator.guid!==e.item.creator.guid)}),a=t.computed(()=>"specificationImgUrl"in e.item?e.item.specificationImgUrl:void 0),l=t.computed(()=>"changedFields"in e.item?e.item.changedFields:[]),c=t.computed(()=>{var d,u;return"replacement"in e.item?(u=(d=e.item.replacement)==null?void 0:d.creator)==null?void 0:u.type:void 0});return(d,u)=>(t.openBlock(),t.createElementBlock("div",s4,[t.createElementVNode("div",{class:t.normalizeClass(o.value?"line-through opacity-50":"")},[t.createVNode(Tr,{product:n.item.product,"show-additional-sale-icon":n.item.isAdditionalSale??!1,"show-code":!1},null,8,["product","show-additional-sale-icon"])],2),n.item.marker?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(o.value?"line-through opacity-50":"")},[u[0]||(u[0]=t.createTextVNode(" Маркировка: ",-1)),t.createElementVNode("span",a4,t.toDisplayString(n.item.marker),1)],2)):t.createCommentVNode("",!0),a.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(o.value?"line-through opacity-50":"")},[t.createVNode(o4,{src:a.value},null,8,["src"])],2)):t.createCommentVNode("",!0),s.value&&!o.value?(t.openBlock(),t.createBlock(Jr,{key:2,"user-type":n.item.creator.type,class:"mt-1 self-start","prefix-text":"Добавлено"},null,8,["user-type"])):t.createCommentVNode("",!0),n.item.isRemoved&&!n.item.replacementId&&l.value.length===0?(t.openBlock(),t.createBlock(Jr,{key:3,class:"mt-1 self-start","prefix-text":"Удалено",variant:"danger"})):t.createCommentVNode("",!0),n.item.replacementId&&l.value.length>0?(t.openBlock(),t.createBlock(Jr,{key:4,"user-type":c.value,"changed-fields":l.value,class:"mt-1 self-start"},null,8,["user-type","changed-fields"])):t.createCommentVNode("",!0)]))}}),d4={key:0,class:"!mb-3 !mt-0 text-base font-semibold"},u4={class:"mb-1 flex flex-wrap items-baseline justify-between gap-2"},f4={class:"flex items-baseline gap-2"},h4={class:"text-base font-bold text-sc-dark-grey"},m4={key:0,class:"text-sm text-sc-grey"},p4={key:0,class:"text-sm text-sc-dark-grey"},g4={},y4=t.defineComponent({...g4,__name:"order-items-list",props:t.mergeModels({products:{},maxHeight:{default:void 0},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},title:{default:"Список позиций"},groups:{default:void 0},extraColumns:{default:void 0},isItemInactive:{type:Function,default:void 0},isItemSelectable:{type:Function,default:void 0},updateQuantityOnInput:{type:Boolean,default:!0}},{selectedRowKeys:{default:()=>[]},selectedRowKeysModifiers:{}}),emits:["update:selectedRowKeys"],setup(n){const e=n,i=t.useModel(n,"selectedRowKeys"),r=b=>M.sortBy(b,"ord"),o=t.computed(()=>r(e.products)),s=b=>e.isItemInactive?e.isItemInactive(b):!!b.isRemoved||!!b.replacementId,a=b=>e.isItemSelectable?e.isItemSelectable(b):!s(b),l=(b,y)=>{y?i.value.includes(b)||(i.value=[...i.value,b]):i.value=i.value.filter(_=>_!==b)},c=b=>e.selectable?{class:i.value.includes(b.id)?void 0:"opacity-60"}:{},d=(b,y)=>{const _=o.value,k=b.logicGroupId;if(!k)return 1;const x=_.at(y-1);if(y&&x&&x.logicGroupId===k)return 0;const v=_.slice(y),B=v.findIndex(w=>w.logicGroupId!==k);return B===-1?v.length:B},u=b=>s(b)?null:t.h(F.NButton,{quaternary:!0,size:"small",type:"error",onClick:()=>{var y;(y=e.eventEmitter)==null||y.emit("order-item:delete",{item:b})}},()=>t.h(i4)),f=t.ref(Xe.getDeviceTypeByResolution()),h=t.ref(window.innerWidth),p=()=>{const b=[{title:"№ п.п.",key:"id",resizable:!0,width:50,render:(_,k)=>t.h("span",{class:`text-base${s(_)?" line-through opacity-50":""}`},[k+1,"."])},{title:"Артикул",key:"codeNumber",resizable:!0,width:h.value>=1536?156:120,render:_=>t.h("span",{class:`text-base${s(_)?" line-through opacity-50":""}`},[_.product.code])},{title:"Наименование",key:"name",resizable:!0,render:_=>t.h(c4,{item:_})},{title:"Кол-во",key:"quantity",resizable:!0,width:180,rowSpan:d,render:_=>t.h(ml,{class:s(_)?"line-through opacity-50":"",item:_,eventEmitter:e.eventEmitter,allowEdit:e.allowEdit&&!s(_),updateQuantityOnInput:e.updateQuantityOnInput})},{title:"Цена за ед.",key:"costOneRub",resizable:!0,width:120,render:_=>t.h("div",{class:s(_)?"line-through opacity-50":""},[t.h(ai,{product:_,costFieldName:"costOne",showQuantityUnit:!0})])},{title:"Сумма",key:"cost",resizable:!0,width:120,render:_=>t.h("div",{class:s(_)?"line-through opacity-50":""},[t.h(ai,{product:_,costFieldName:"cost",showCurrency:!0})])},...e.extraColumns??[],...e.allowEdit?[{title:"",key:"delete",width:44,rowSpan:d,render:_=>u(_)}]:[]],y=e.selectable?[{key:"checkbox",title:"",className:"align-top",width:"32",cellProps:_=>({class:a(_)?"cursor-pointer":void 0,onClick:()=>{a(_)&&l(_.id,!i.value.includes(_.id))}}),render:_=>t.h(F.NCheckbox,{checked:i.value.includes(_.id),disabled:!a(_)})}]:[];switch(f.value){case je.phone:case je.tablet:return[...y,{title:"",key:"items",resizable:!0,render:(_,k)=>{const x=d(_,k)>0,v=e.allowEdit&&!s(_)&&x;return t.h(lm,{product:_,index:k,eventEmitter:e.eventEmitter,allowEdit:v,updateQuantityOnInput:e.updateQuantityOnInput},{actions:()=>u(_)})}}];case je.laptop:return[...y,...b];default:return[...y,...b]}},m=t.computed(()=>p()),g=()=>{f.value=Xe.getDeviceTypeByResolution(),h.value=window.innerWidth};return t.onMounted(()=>{g(),window.addEventListener("resize",g)}),t.onUnmounted(()=>{window.removeEventListener("resize",g)}),(b,y)=>{const _=F.NDataTable;return t.openBlock(),t.createElementBlock(t.Fragment,null,[n.title?(t.openBlock(),t.createElementBlock("h3",d4,t.toDisplayString(n.title),1)):t.createCommentVNode("",!0),n.groups?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.groups,k=>(t.openBlock(),t.createElementBlock("div",{key:k.name,class:"mb-6 last:mb-0"},[t.createElementVNode("div",u4,[t.createElementVNode("div",f4,[t.createElementVNode("span",h4,t.toDisplayString(k.name),1),k.description?(t.openBlock(),t.createElementBlock("span",m4,t.toDisplayString(k.description),1)):t.createCommentVNode("",!0)]),k.summary?(t.openBlock(),t.createElementBlock("span",p4,t.toDisplayString(k.summary),1)):t.createCommentVNode("",!0)]),t.createVNode(_,{columns:m.value,data:r(k.items),"row-key":x=>x.id,"row-props":c,"bottom-bordered":!1,bordered:!1,"max-height":n.maxHeight},null,8,["columns","data","row-key","max-height"])]))),128)):(t.openBlock(),t.createBlock(_,{key:2,columns:m.value,data:o.value,"row-key":k=>k.id,"row-props":c,"bottom-bordered":!1,bordered:!1,"max-height":n.maxHeight},null,8,["columns","data","row-key","max-height"]))],64)}}}),dm=fn(y4,[["__scopeId","data-v-e91ed0e6"]]),b4={key:0,class:"text-sc-dark-grey my-2 text-center"},_4={key:1,class:"text-sc-dark-grey my-2"},w4={},um=t.defineComponent({...w4,__name:"order-status-history",props:{order:{}},setup(n){const e=n,i=t.ref(!1),r=t.ref([]),o=a=>{const{uiDateWithTime:l}=j.useBaseConfigStateStore().config.dateFormats;return xe.format(a,l)},s=(a=!0)=>{a&&(i.value=!0),j.HttpRequester.getInstance(j.OrdersDataProvider).getOrderStatusHistory(e.order.id).then(l=>{r.value=l}).finally(()=>{a&&(i.value=!1)})};return t.watch(()=>e.order,()=>{s(!1)}),t.onMounted(()=>{s()}),(a,l)=>{const c=F.NSpin,d=F.NTimelineItem,u=F.NTimeline;return t.openBlock(),t.createElementBlock("div",null,[l[1]||(l[1]=t.createElementVNode("h3",{class:"!mb-3 !mt-0 text-base font-semibold"},"История статусов",-1)),i.value?(t.openBlock(),t.createElementBlock("div",b4,[t.createVNode(c,{size:"small",class:"mb-1 align-middle"}),l[0]||(l[0]=t.createElementVNode("span",{class:"ml-2"},"Загрузка истории ...",-1))])):r.value.length===0?(t.openBlock(),t.createElementBlock("div",_4," История статусов отсутствует. ")):(t.openBlock(),t.createBlock(u,{key:2},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(f,h)=>(t.openBlock(),t.createBlock(d,{key:h,color:t.unref(wi)(f.status.slug).color,time:o(f.createdAt),content:f.user.name},{header:t.withCtx(()=>[t.createVNode(cm,{status:f.status,"status-detail":f.statusDetail,variant:h===0?"filled":"text","show-dot":!1,size:"small"},null,8,["status","status-detail","variant"])]),_:2},1032,["color","time","content"]))),128))]),_:1}))])}}}),x4={class:"text-base"},k4={},yl=t.defineComponent({...k4,__name:"user-short-info",props:{user:{},showUserType:{type:Boolean,default:!0},extraInfoOnSecondLine:{type:Boolean,default:!0}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass({"flex flex-col":n.showUserType&&n.extraInfoOnSecondLine})},[t.createElementVNode("span",x4,t.toDisplayString(n.user.name),1),n.showUserType?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([{"ml-1":!n.extraInfoOnSecondLine},"text-sc-grey"])}," ["+t.toDisplayString(n.user.type)+"] ",3)):t.createCommentVNode("",!0)],2))}}),C4={class:"ml-4 grid grid-cols-3 gap-1.5 text-base"},v4={class:"col-span-2"},S4={class:"col-span-2"},B4={},fm=t.defineComponent({...B4,__name:"order-details",props:{order:{}},emits:["click:client-name"],setup(n,{emit:e}){const i=e;return(r,o)=>(t.openBlock(),t.createElementBlock("div",null,[o[11]||(o[11]=t.createElementVNode("h3",null,"Детали заказа",-1)),t.createElementVNode("div",C4,[n.order.creator.id!==n.order.client.id?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o[1]||(o[1]=t.createElementVNode("span",null,"Создал",-1)),t.createVNode(yl,{user:n.order.creator,class:"col-span-2"},null,8,["user"])],64)):t.createCommentVNode("",!0),o[10]||(o[10]=t.createElementVNode("span",null,"Клиент",-1)),t.createVNode(Ir,{client:n.order.client,class:"col-span-2","onClick:clientName":o[0]||(o[0]=s=>i("click:client-name",n.order.client,s))},null,8,["client"]),n.order.contragent?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o[2]||(o[2]=t.createElementVNode("span",null,"Контрагент",-1)),t.createVNode(Zu,{contragent:n.order.contragent,class:"col-span-2"},null,8,["contragent"])],64)):t.createCommentVNode("",!0),n.order.image?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[o[3]||(o[3]=t.createElementVNode("span",null,"Графический файл клиента",-1)),o[4]||(o[4]=t.createElementVNode("a",{class:"fancybox col-span-2",href:"{{ order.image }}"}," Посмотреть ",-1))],64)):t.createCommentVNode("",!0),n.order.barcode?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[o[5]||(o[5]=t.createElementVNode("span",null,"Штрих-код",-1)),t.createElementVNode("span",v4,t.toDisplayString(n.order.barcode),1)],64)):t.createCommentVNode("",!0),n.order.payment?(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[o[6]||(o[6]=t.createElementVNode("span",null,"Оплата",-1)),t.createVNode(pl,{payment:n.order.payment,class:"col-span-2"},null,8,["payment"])],64)):t.createCommentVNode("",!0),n.order.delivery?(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[o[7]||(o[7]=t.createElementVNode("span",null,"Доставка",-1)),t.createVNode(gs,{delivery:n.order.delivery,class:"col-span-2"},null,8,["delivery"])],64)):t.createCommentVNode("",!0),n.order.comment?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[o[8]||(o[8]=t.createElementVNode("span",null,"Комментарий",-1)),t.createElementVNode("span",S4,t.toDisplayString(n.order.comment),1)],64)):t.createCommentVNode("",!0),n.order.attachedUser?(t.openBlock(),t.createElementBlock(t.Fragment,{key:7},[o[9]||(o[9]=t.createElementVNode("span",null,"Закреплен за",-1)),t.createVNode(yl,{user:n.order.attachedUser,class:"col-span-2"},null,8,["user"])],64)):t.createCommentVNode("",!0)])]))}}),N4={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function T4(n,e){return t.openBlock(),t.createElementBlock("svg",N4,[...e[0]||(e[0]=[t.createElementVNode("rect",{width:"336",height:"336",x:"128",y:"128",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32",rx:"57",ry:"57"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m383.5 128l.5-24a56.16 56.16 0 0 0-56-56H112a64.19 64.19 0 0 0-64 64v216a56.16 56.16 0 0 0 56 56h24"},null,-1)])])}const $4=t.markRaw({name:"ion-copy-outline",render:T4}),E4={class:"flex flex-col items-stretch gap-1.5 text-base"},R4={},P4=t.defineComponent({...R4,__name:"order-external-links",props:{showErpLink:{type:Boolean,default:!1},order:{}},setup(n){const e=t.computed(()=>{var r,o;const i=(((r=n.order.invoices)==null?void 0:r.length)??0)>0;return n.showErpLink&&!!n.order.erpOrderUrl||i||!!((o=n.order.payment)!=null&&o.onlinePaymentLink)});return(i,r)=>{var a;const o=F.NButton,s=$4;return e.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[r[2]||(r[2]=t.createElementVNode("h3",{class:"!mb-3 !mt-0 text-base font-semibold"},"Внешние ссылки",-1)),t.createElementVNode("div",E4,[n.showErpLink&&n.order.erpOrderUrl?(t.openBlock(),t.createBlock(o,{key:0,tag:"a",href:n.order.erpOrderUrl,target:"_blank",block:"",class:"sc-external-link-button"},{default:t.withCtx(()=>[...r[0]||(r[0]=[t.createTextVNode(" Открыть в ERP ",-1)])]),_:1},8,["href"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.order.invoices??[],(l,c)=>(t.openBlock(),t.createBlock(o,{key:c,tag:"a",href:l,block:"",class:"sc-external-link-button"},{default:t.withCtx(()=>[t.createTextVNode(" Скачать счет №"+t.toDisplayString(c+1),1)]),_:2},1032,["href"]))),128)),(a=n.order.payment)!=null&&a.onlinePaymentLink?t.withDirectives((t.openBlock(),t.createBlock(o,{key:1,block:"",class:"sc-external-link-button",title:"Ссылка на оплату копируется в буфер обмена"},{default:t.withCtx(()=>[t.createVNode(s,{class:"mr-1.5"}),r[1]||(r[1]=t.createTextVNode(" Скопировать ссылку на оплату ",-1))]),_:1})),[[t.unref(zl),n.order.payment.onlinePaymentLink]]):t.createCommentVNode("",!0)])],64)):t.createCommentVNode("",!0)}}}),hm=fn(P4,[["__scopeId","data-v-6a3ae627"]]),F4={key:0},V4={class:"text-sc-dark-grey my-2 text-center"},M4={key:1,class:"text-sc-dark-grey my-2 text-center"},I4={key:2},A4={class:"text-sc-dark-grey mt-4 text-right font-bold"},O4={class:"text-sc-primary"},z4={class:"mb-4 max-w-xs empty:hidden"},D4={},mm=t.defineComponent({...D4,__name:"order-info",props:{order:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1}},emits:["click:client-name"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.ref();t.provide(j.currentOrderInjectionKey,t.computed(()=>s.value??null));const a=(d=!0)=>{if("products"in i.order){s.value=new j.Order(i.order);return}d&&(o.value=!0),j.HttpRequester.getInstance(j.OrdersDataProvider).getOrder(i.order.id).then(u=>{s.value=u}).finally(()=>{d&&(o.value=!1)})},l=t.computed(()=>{var d;return(((d=s.value)==null?void 0:d.products)??[]).filter(u=>!u.isRemoved&&!u.replacementId)}),c=t.computed(()=>l.value.reduce((d,u)=>d+u.costRub,0).toLocaleString("ru-ru",{minimumFractionDigits:2}));return t.watch(()=>i.order,()=>{a(!1)}),t.onMounted(()=>{a()}),(d,u)=>{const f=F.NSpin;return o.value?(t.openBlock(),t.createElementBlock("div",F4,[t.createElementVNode("div",V4,[t.createVNode(f,{size:"small",class:"mb-2.5 align-middle"}),u[1]||(u[1]=t.createElementVNode("div",null,[t.createElementVNode("span",null,"Загрузка данных ...")],-1))])])):!s.value||s.value.products.length===0?(t.openBlock(),t.createElementBlock("div",M4," --- Не удалось загрузить данные о заказе --- ")):(t.openBlock(),t.createElementBlock("div",I4,[t.createVNode(dm,{products:l.value,"event-emitter":n.eventEmitter,"allow-edit":n.allowEdit},null,8,["products","event-emitter","allow-edit"]),t.createElementVNode("div",A4,[u[2]||(u[2]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",O4,t.toDisplayString(c.value)+" ₽",1)]),t.createVNode(fm,{order:s.value,"onClick:clientName":u[0]||(u[0]=h=>r("click:client-name",s.value.client,h))},null,8,["order"]),t.createElementVNode("div",z4,[t.createVNode(hm,{order:s.value,"show-erp-link":""},null,8,["order"])]),t.createVNode(um,{order:s.value},null,8,["order"])]))}}}),L4={},H4=t.defineComponent({...L4,__name:"order-actions",props:{orderContextButtonsConfig:{type:Function,default:void 0},onOrderContextSelect:{type:Function,default:void 0},order:{}},setup(n){const e=n,i=t.inject(Br,"small"),r=t.computed(()=>M.isNil(e.orderContextButtonsConfig)?[]:M.isFunction(e.orderContextButtonsConfig)?e.orderContextButtonsConfig(e.order):e.orderContextButtonsConfig),o=s=>{var a;(a=e.onOrderContextSelect)==null||a.call(e,e.order,s)};return(s,a)=>{var u;const l=$s,c=F.NButton,d=F.NDropdown;return((u=r.value)==null?void 0:u.length)>0?(t.openBlock(),t.createBlock(d,{key:0,options:r.value,size:t.unref(i),trigger:"click",onSelect:o},{default:t.withCtx(()=>[t.createVNode(c,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(l)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)}}}),W4={},j4=t.defineComponent({...W4,__name:"orders-list",props:t.mergeModels({fields:{},showAttachedUserColumn:{type:Boolean,default:!1},orderContextButtonsConfig:{},onOrderContextSelect:{},orderUrl:{},tableMinWidth:{default:1/0},filters:{default:void 0},sort:{default:void 0},pagination:{default:void 0},useCellIndication:{type:Boolean,default:!1},highlightSettings:{default:void 0},enableSorting:{type:Boolean,default:!1},refreshInterval:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0},selectable:{type:Boolean,default:!1},isRowSelectable:{type:Function,default:void 0}},{checkedRowKeys:{default:()=>[]},checkedRowKeysModifiers:{}}),emits:t.mergeModels(["click:client-name","dblclick:row","update:pagination","update:sort"],["update:checkedRowKeys"]),setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useModel(n,"checkedRowKeys"),a=(P,q)=>{q?s.value.includes(P)||(s.value=[...s.value,P]):s.value=s.value.filter(K=>K!==P)},l=()=>M.cloneDeep(r.sort??[{field:"id",direction:"desc"}]),c=t.ref(l()),d=t.ref([]),u=t.ref(!1),f=t.ref(700),h=()=>{const P=Xe.getDeviceTypeByResolution(),q=P===je.phone||P===je.tablet;if(!(!r.stickyHeaderOnMobile&&q))return f.value*(j.useBaseConfigStateStore().config.tableDefaultHeightCoefficient??.6)},p=t.ref(h()),m=t.computed(()=>r.highlightSettings?r.highlightSettings:{statuses:[],markers:r.useCellIndication?[...so]:[]}),g=P=>{const q={onDblclick:()=>o("dblclick:row",P)},K=[];r.selectable&&s.value.length>0&&!s.value.includes(P.id)&&K.push("opacity-60");const J=m.value,Y=new Set(Ns(P).filter(ce=>J.markers.includes(ce))),V={},ie=[rt.NotInStock,rt.OnOrder,rt.LargeOrder].find(ce=>Y.has(ce));if(ie){const ce=Sr(ie);K.push("order-id-marked",ie),V["--sc-order-id-bg"]=ce.backgroundColor,V["--sc-order-id-text"]=ce.textOnBackgroundColor}if(Y.has(rt.NextDayDelivery)){const ce=Sr(rt.NextDayDelivery);K.push("delivery-date-marked"),V["--sc-delivery-date-bg"]=ce.backgroundColor,V["--sc-delivery-date-text"]=ce.textOnBackgroundColor}return P.status.slug&&J.statuses.includes(P.status.slug)&&(K.push("order-status-highlighted",P.status.slug),M.assign(V,jl(P.status.slug))),M.isEmpty(V)||(q.style=V),K.length>0&&(q.class=K.join(" ")),q},b=()=>{const P=[Me.CreatedAt,Me.Id,Me.ClientInfo,Me.ClientCity,Me.DeliveryDate,Me.PaymentType,Me.SalesDirections,Me.Status,...r.showAttachedUserColumn?[Me.AttachedUser]:[],Me.actions],q=r.fields.length>0?r.fields:P,K={title:"???",key:"undefined",render:()=>t.h("span",{},["--- unknown ---"])},J={type:"expand",expandable:M.constant(!0),renderExpand:A=>t.h(mm,{order:A,class:"pl-10 pt-3 pb-10","onClick:client-name":()=>{o("click:client-name",A.client,null)}}),width:"30"};let Y=[{title:"Дата заказа",key:Me.CreatedAt,resizable:!0,width:100,render:A=>t.h(Ko,{date:A.createdAt,isTimeSecondary:!0,isTimeOnSecondLine:!0,class:"text-base"})},{title:"№ заказа",key:Me.Id,resizable:!0,width:75,className:"order-id",render:A=>t.h("a",{href:r.orderUrl.replace(":id",A.id.toString()),class:"text-base"},A.id)},{title:"Дата доставки / самовывоза",key:Me.DeliveryDate,resizable:!0,width:120,className:"delivery-date",render:A=>t.h(Ko,{date:A.delivery.date,isShowTime:!1,class:"text-base"})},{title:"Клиент",key:Me.ClientInfo,resizable:!0,minWidth:320,render:A=>t.h(Ir,{client:A.client,"onClick:client-name":()=>{o("click:client-name",A.client,null)}})},{title:"Тип доставки",key:Me.DeliveryInfo,resizable:!0,minWidth:320,render:A=>t.h(gs,{delivery:A.delivery})},{title:"Клиент",key:Me.ClientInfoShort,resizable:!0,minWidth:320,render:A=>t.h(Ir,{client:A.client,showCityAndRegion:!1,"onClick:client-name":()=>{o("click:client-name",A.client,null)}})},{title:"Город клиента",key:Me.ClientCity,resizable:!0,minWidth:90,width:120,render:A=>{var ie;return t.h("span",{class:"text-base"},((ie=A.client)==null?void 0:ie.city.name)??"—")}},{title:"Статус",key:Me.Status,resizable:!0,width:150,minWidth:115,className:"order-status",render:A=>t.h("span",{class:"text-base"},[A.status.name])},{title:"Тип оплаты",key:Me.PaymentType,resizable:!0,width:115,minWidth:95,render:A=>A.payment?t.h(pl,{payment:A.payment}):t.h("span",{class:"text-base"},"—")},{title:"Напр. продаж",key:Me.SalesDirections,resizable:!0,width:80,render:A=>{var ie;return t.h("span",{class:"text-base"},[((ie=A.salesDirection)==null?void 0:ie.name)??""])}},...r.showAttachedUserColumn?[{title:"Закреплено за",key:Me.AttachedUser,resizable:!0,minWidth:120,render:A=>{var ie;return t.h("span",{class:"text-base"},[((ie=A==null?void 0:A.attachedUser)==null?void 0:ie.name)??""])}}]:[]];r.orderContextButtonsConfig&&Y.push({key:"actions",title:"",className:"align-top",width:50,render:A=>t.h(H4,{order:A,orderContextButtonsConfig:r.orderContextButtonsConfig,onOrderContextSelect:r.onOrderContextSelect})}),r.enableSorting&&(Y=Y.map(A=>[Me.Id,Me.CreatedAt,Me.DeliveryDate].includes(A.key)?{...A,sorter:!0,sortOrder:!1,...A.width===void 0?{}:{width:A.width+16}}:A));const V=r.selectable?[{key:"selection",title:"",className:"align-top",width:"32",cellProps:A=>{var ce;const ie=((ce=r.isRowSelectable)==null?void 0:ce.call(r,A))??!0;return{class:ie?"cursor-pointer":void 0,onClick:()=>{ie&&a(A.id,!s.value.includes(A.id))}}},render:A=>{var ie;return((ie=r.isRowSelectable)==null?void 0:ie.call(r,A))??!0?t.h(F.NCheckbox,{checked:s.value.includes(A.id)}):null}}]:[];switch(Xe.getDeviceTypeByResolution()){case je.phone:case je.tablet:return[...V,J,{key:"order",title:"Заказ",resizable:!0,render:A=>t.h(am,{order:A,fields:q,orderUrl:r.orderUrl,highlightSettings:m.value})}];case je.laptop:{const A=r.showAttachedUserColumn?q:q.filter(ie=>ie!==Me.AttachedUser);return[...V,J,...A.map(ie=>Y.find(ce=>ce.key===ie)??K)]}default:return[K]}},y=t.ref(b()),_=t.ref(new j.TableDataPagination(r.pagination??{page:1,pageSize:10,itemCount:0,pageCount:1,pageSlot:5,pageSizes:[10,15,25],showSizePicker:!0})),k=t.computed(()=>({..._.value,prefix({itemCount:P}){return`Всего заказов: ${P}`}})),x=t.ref(null),v=t.ref(null),B=t.ref(null),w=t.ref(null),T=t.ref(null),C=()=>{T.value!==null&&(clearInterval(T.value),T.value=null)},$=()=>{C(),r.refreshInterval&&(T.value=setInterval(()=>{R()},r.refreshInterval))},E=P=>{_.value.itemCount!==P.meta.total&&(_.value.itemCount=P.meta.total),_.value.page!==P.meta.currentPage&&(_.value.page=P.meta.currentPage),_.value.pageCount!==P.meta.lastPage&&(_.value.pageCount=P.meta.lastPage),_.value.pageSize!==P.meta.perPage&&(_.value.pageSize=P.meta.perPage),d.value=P.data},I=()=>{var P,q,K;r.filters&&((P=v.value)==null||P.abort(),v.value=null,(q=B.value)==null||q.abort(),B.value=null,w.value=null,(K=x.value)==null||K.abort(),x.value=new AbortController,u.value=!0,j.HttpRequester.getInstance(j.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},x.value.signal).then(J=>{E(J),u.value=!1}).catch(J=>{if((J==null?void 0:J.name)!=="CanceledError")throw u.value=!1,J}))},R=()=>{var P;!r.filters||u.value||((P=v.value)==null||P.abort(),v.value=new AbortController,j.HttpRequester.getInstance(j.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},v.value.signal).then(q=>{d.value=d.value.map(K=>q.data.find(Y=>Y.id===K.id)??K),_.value.itemCount!==q.meta.total&&(_.value.itemCount=q.meta.total),_.value.pageCount!==q.meta.lastPage&&(_.value.pageCount=q.meta.lastPage)}).catch(q=>{if((q==null?void 0:q.name)!=="CanceledError")throw q}))},O=P=>P.meta.total===_.value.itemCount&&M.isEqual(M.map(P.data,"id"),M.map(d.value,"id")),U=async()=>{var q,K;if(!r.filters||u.value)return!1;(q=v.value)==null||q.abort(),v.value=null,(K=B.value)==null||K.abort(),B.value=new AbortController;let P;try{P=await j.HttpRequester.getInstance(j.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},B.value.signal)}catch(J){if((J==null?void 0:J.name)==="CanceledError")return!1;throw J}return O(P)?(d.value=d.value.map(J=>P.data.find(Y=>Y.id===J.id)??J),w.value=null,!1):(w.value=P,!0)},Q=()=>w.value?(E(w.value),w.value=null,!0):!1,G=()=>{w.value=null},W=P=>{_.value.page=P,I(),o("update:pagination",_.value)},D=P=>{_.value.pageSize=P,_.value.page=1,I(),o("update:pagination",_.value)},L=P=>{if(M.isNull(P))c.value=l();else{const[q]=c.value;q.field=P.columnKey.toString(),q.direction=P.order==="ascend"?"asc":"desc",c.value=[q]}y.value.forEach(q=>{if(Object.hasOwn(q,"sortOrder")){const K=q;K.sortOrder=K.key===(P==null?void 0:P.columnKey)&&(P!=null&&P.sorter)&&P.order!==!1?P.order:!1}}),I(),o("update:sort",c.value)},z=()=>{y.value=b(),f.value=window.innerHeight,p.value=h()};return t.watch(()=>r.filters,()=>{_.value.page=1,I(),$()}),t.watch(()=>r.sort,()=>{c.value=l(),_.value.page=1,I(),$()}),t.onMounted(()=>{z(),window.addEventListener("resize",z),t.nextTick(()=>{I(),$()})}),t.onUnmounted(()=>{var P,q,K;window.removeEventListener("resize",z),(P=x.value)==null||P.abort(),(q=v.value)==null||q.abort(),(K=B.value)==null||K.abort(),C()}),e({reload:I,checkForUpdates:U,applyPendingUpdate:Q,discardPendingUpdate:G}),(P,q)=>{const K=F.NDataTable;return t.openBlock(),t.createBlock(K,{columns:y.value,data:d.value,"row-key":J=>J.id,"row-props":g,"scroll-x":n.tableMinWidth,pagination:k.value,loading:u.value,remote:!0,bordered:!1,"bottom-bordered":!1,"sticky-expanded-rows":!0,"max-height":p.value,"pagination-behavior-on-filter":"first","onUpdate:page":W,"onUpdate:pageSize":D,"onUpdate:sorter":L},null,8,["columns","data","row-key","scroll-x","pagination","loading","max-height"])}}}),q4=fn(j4,[["__scopeId","data-v-aff76adb"]]),X4=t.computed(()=>j.useReferencesStore().deliveryTypeReference??[]),Y4=t.computed(()=>j.useReferencesStore().managersList??[]),U4=t.computed(()=>j.useReferencesStore().opfReference??[]),K4=t.computed(()=>j.useReferencesStore().partnerGroupsReference??[]),G4=t.computed(()=>j.useReferencesStore().priceCoefficientsReference??[]),Z4=t.computed(()=>j.useReferencesStore().productFilesTypesReference??[]),Q4=t.computed(()=>j.useReferencesStore().resourceTypesReference),J4=t.computed(()=>j.useReferencesStore().salesDirectionsReference??[]),eN=t.computed(()=>j.useReferencesStore().warehousesReference??[]),tN=t.computed(()=>j.useReferencesStore().paymentTypeReference??[]),pm=t.computed(()=>j.useReferencesStore().orderStatusReference??[]),nN=t.computed(()=>j.useReferencesStore().orderStatusDetailReference??[]),iN=t.computed(()=>j.useReferencesStore().operatorReference??[]),rN=t.computed(()=>gt.convertReferencesToSelectOptionsList(j.useReferencesStore().channelPrimaryInterestsReference??[],!0,!1,!0)),oN=t.computed(()=>gt.convertReferencesToSelectOptionsList(j.useReferencesStore().sourcePrimaryInterestsReference??[],!0,!1,!0)),sN=n=>j.HttpRequester.getInstance(j.ReferenceDataProvider).searchCity(n),aN=n=>gt.convertReferencesToSelectOptionsList(n,!0,!1,!1,e=>{var i,r,o;return e!=null&&e.isNewRec()?"-":`${e.name}, ${(i=e==null?void 0:e.region)==null?void 0:i.name}, ${(o=(r=e==null?void 0:e.region)==null?void 0:r.country)==null?void 0:o.name}`},e=>e==null?void 0:e.isNewRec()),lN=async n=>M.map(await j.HttpRequester.getInstance(j.ReferenceDataProvider).searchRegion(n),e=>new j.Region(e)),cN=n=>gt.convertReferencesToSelectOptionsList(n,!0,!1,!1,e=>e.isNewRec()?"-":M.join(M.compact([e.name,e.country.name]),", "),e=>e.isNewRec()),dN=n=>j.HttpRequester.getInstance(j.ClientDataProvider).searchClient(n),uN=n=>gt.convertReferencesToSelectOptionsList(n,!0,!1,!1,e=>e.isNewRec()?"-":[e.name,e.salesDirection.name?`(${e.salesDirection.name})`:void 0,e.city.name?`г. ${e.city.name}${e.city.region.name?`, ${e.city.region.name}`:""}`:void 0,e.isActive?void 0:"[ Деактивирован ]"].filter(Boolean).join(" "),e=>e==null?void 0:e.isNewRec()),fN={class:"flex flex-col gap-4"},hN={class:"flex flex-wrap gap-2"},mN={class:"flex flex-col gap-1.5"},pN={class:"inline-flex items-center gap-2"},gN={class:"flex flex-col gap-1.5"},yN={class:"inline-flex items-center gap-2"},bN={},_N=t.defineComponent({...bN,__name:"order-highlight-settings",props:{settings:{},statuses:{default:void 0}},emits:["update:settings"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>i.statuses??pm.value),s=d=>!!d&&i.settings.statuses.includes(d),a=(d,u)=>{if(!d)return;const f=i.settings.statuses.filter(h=>h!==d);r("update:settings",{...i.settings,statuses:u?[...f,d]:f})},l=(d,u)=>{const f=i.settings.markers.filter(h=>h!==d);r("update:settings",{...i.settings,markers:u?[...f,d]:f})},c=d=>{r("update:settings",{statuses:d?o.value.flatMap(u=>u.slug?[u.slug]:[]):[],markers:d?[...so]:[]})};return(d,u)=>{const f=F.NButton,h=F.NCheckbox;return t.openBlock(),t.createElementBlock("div",fN,[t.createElementVNode("div",hN,[t.createVNode(f,{size:"small",onClick:u[0]||(u[0]=p=>c(!0))},{default:t.withCtx(()=>[...u[2]||(u[2]=[t.createTextVNode(" Выделять всё ",-1)])]),_:1}),t.createVNode(f,{size:"small",onClick:u[1]||(u[1]=p=>c(!1))},{default:t.withCtx(()=>[...u[3]||(u[3]=[t.createTextVNode(" Снять всё ",-1)])]),_:1})]),t.createElementVNode("div",mN,[u[4]||(u[4]=t.createElementVNode("div",{class:"text-sm font-semibold"},"Статусы",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,p=>(t.openBlock(),t.createBlock(h,{key:p.id,checked:s(p.slug),"onUpdate:checked":m=>a(p.slug,m)},{default:t.withCtx(()=>[t.createElementVNode("span",pN,[t.createVNode(gl,{colors:t.unref(wi)(p.slug)},null,8,["colors"]),t.createTextVNode(" "+t.toDisplayString(p.name),1)])]),_:2},1032,["checked","onUpdate:checked"]))),128))]),t.createElementVNode("div",gN,[u[5]||(u[5]=t.createElementVNode("div",{class:"text-sm font-semibold"},"Маркеры",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(so),p=>(t.openBlock(),t.createBlock(h,{key:p,checked:n.settings.markers.includes(p),"onUpdate:checked":m=>l(p,m)},{default:t.withCtx(()=>[t.createElementVNode("span",yN,[t.createVNode(gl,{colors:t.unref(Sr)(p)},null,8,["colors"]),t.createTextVNode(" "+t.toDisplayString(t.unref(Bs)(p)),1)])]),_:2},1032,["checked","onUpdate:checked"]))),128))])])}}}),wN=["href"],xN={class:"text-sc-dark-grey"},kN={},CN=t.defineComponent({...kN,__name:"short-text-order-info",props:{order:{},orderLink:{}},emits:["click:order-id"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>xe.format(i.order.createdAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime)),s=a=>{M.isNil(i.orderLink)&&(a.preventDefault(),a.stopPropagation()),r("click:order-id",i.order,a)};return(a,l)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("span",null,[l[1]||(l[1]=t.createTextVNode(" #",-1)),t.createElementVNode("a",{href:n.orderLink??"#",onClick:l[0]||(l[0]=c=>s(c))},t.toDisplayString(n.order.id),9,wN),t.createTextVNode(" от "+t.toDisplayString(o.value),1)]),l[2]||(l[2]=t.createTextVNode(", ",-1)),t.createElementVNode("span",xN,"автор: "+t.toDisplayString(n.order.creator.name)+" ["+t.toDisplayString(n.order.creator.type)+"]",1)],64))}}),vN={class:"sc-page flex flex-col bg-inherit"},SN={class:"my-2 flex flex-row items-end"},BN={class:"sc-title grow"},NN={key:0,class:"sc-title-buttons flex-1 grow-0"},TN={class:"flex flex-col justify-end gap-1 sm:mt-0 sm:flex-row"},$N={key:0,class:"sc-title-extra mt-2 sm:mt-4"},EN={},gm=t.defineComponent({...EN,__name:"page",props:{title:{default:void 0},stickyHeader:{type:Boolean},stickyTopOffset:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>e.stickyHeaderOnMobile?"sticky z-10 bg-inherit":"lg:sticky z-10 bg-inherit");return(r,o)=>{const s=F.NH1;return t.openBlock(),t.createElementBlock("div",vN,[t.createElementVNode("div",{class:t.normalizeClass(n.stickyHeader?i.value:void 0),style:t.normalizeStyle(n.stickyHeader?{top:`${n.stickyTopOffset??0}px`}:void 0)},[t.createElementVNode("div",SN,[t.createElementVNode("div",BN,[t.renderSlot(r.$slots,"title",{},()=>[t.createVNode(s,{class:"m-0 leading-none lg:mb-3 lg:leading-normal"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.title??""),1)]),_:1})])]),r.$slots["title-buttons"]?(t.openBlock(),t.createElementBlock("div",NN,[t.createElementVNode("div",TN,[t.renderSlot(r.$slots,"title-buttons")])])):t.createCommentVNode("",!0)]),r.$slots["title-extra"]?(t.openBlock(),t.createElementBlock("div",$N,[t.renderSlot(r.$slots,"title-extra")])):t.createCommentVNode("",!0),t.renderSlot(r.$slots,"sticky-extra")],6),t.renderSlot(r.$slots,"default")])}}}),RN={class:"overflow-hidden transition-all duration-300"},PN={class:"text-lg font-medium leading-none"},FN={},ym=t.defineComponent({...FN,__name:"sliding-content-with-drawer",props:{drawerWidth:{type:[Number,Function],default:void 0},showDrawer:{type:Boolean,default:!1},title:{default:""}},emits:["update:show-drawer"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(0),s=t.ref(i.showDrawer),a=()=>{switch(Xe.getDeviceTypeByResolution()){case je.phone:return window.innerWidth*.8;case je.tablet:return window.innerWidth*.5;default:return window.innerWidth*.33}},l=()=>{s.value?M.isUndefined(i.drawerWidth)?o.value=a():o.value=M.isFunction(i.drawerWidth)?i.drawerWidth():i.drawerWidth:o.value=0};return t.watch(()=>i.drawerWidth,()=>{l()}),t.watch(()=>s.value,()=>{l(),r("update:show-drawer",s.value)}),t.watch(()=>i.showDrawer,c=>{s.value=c}),t.onUnmounted(()=>{window.removeEventListener("resize",l)}),l(),window.addEventListener("resize",l),(c,d)=>{const u=F.NDrawerContent,f=F.NDrawer;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",RN,[t.createElementVNode("div",{style:t.normalizeStyle(`margin-left: ${o.value}px;`),class:"w-full"},[t.renderSlot(c.$slots,"default")],4)]),t.createVNode(f,{show:s.value,"onUpdate:show":d[0]||(d[0]=h=>s.value=h),resizable:!0,width:o.value,placement:"left"},{default:t.withCtx(()=>[t.createVNode(u,{closable:""},{header:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-header",{},()=>[t.createElementVNode("div",PN,t.toDisplayString(n.title),1)])]),default:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-content")]),footer:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-footer")]),_:3})]),_:3},8,["show","width"])],64)}}}),VN={ref:"panel-component-ref",class:"sc-page-panel flex flex-row gap-2.5 bg-inherit sm:gap-8"},MN={key:0},IN={class:"sc-page-preview-panel grow"},AN={key:1,class:"sc-page-preview-panel-extra flex-none"},ON={},zN=t.defineComponent({...ON,__name:"page-with-sliding-panel",props:{title:{},isShowPanelButtonVisible:{type:Boolean,default:!0},showPanelButtonText:{default:""},panelTitle:{default:""},stickyHeader:{type:Boolean,default:!1},stickyTopOffset:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0}},setup(n,{expose:e}){const i=t.ref(!1),r=()=>{i.value=!0},o=()=>{i.value=!1},s=t.useTemplateRef("panel-component-ref");return e({scrollToTopOfPanel:l=>{var c;(c=s.value)==null||c.scrollIntoView({behavior:"smooth"}),l&&t.nextTick(()=>{var d,u;window.scrollTo({top:(((u=(d=s.value)==null?void 0:d.getBoundingClientRect())==null?void 0:u.top)??0)+window.pageYOffset+l,behavior:"smooth"})})},showPanel:r,closePanel:o}),(l,c)=>{const d=F.NButton;return t.openBlock(),t.createBlock(gm,{title:n.title,"sticky-header":n.stickyHeader,"sticky-top-offset":n.stickyTopOffset,"sticky-header-on-mobile":n.stickyHeaderOnMobile},t.createSlots({default:t.withCtx(()=>[t.createVNode(ym,{"show-drawer":i.value,"onUpdate:showDrawer":c[1]||(c[1]=u=>i.value=u),title:n.panelTitle},t.createSlots({"drawer-content":t.withCtx(()=>[t.renderSlot(l.$slots,"panel-content")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"default")]),_:2},[l.$slots["panel-header"]?{name:"drawer-header",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"panel-header")]),key:"0"}:void 0,l.$slots["panel-bottom"]?{name:"drawer-footer",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"panel-bottom")]),key:"1"}:void 0]),1032,["show-drawer","title"])]),_:2},[l.$slots.title?{name:"title",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title")]),key:"0"}:void 0,l.$slots["title-buttons"]?{name:"title-buttons",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title-buttons")]),key:"1"}:void 0,l.$slots["title-extra"]?{name:"title-extra",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title-extra")]),key:"2"}:void 0,l.$slots["preview-panel"]||l.$slots["preview-panel-extra"]||n.isShowPanelButtonVisible?{name:"sticky-extra",fn:t.withCtx(()=>[t.createElementVNode("div",VN,[n.isShowPanelButtonVisible?(t.openBlock(),t.createElementBlock("div",MN,[t.renderSlot(l.$slots,"show-panel-button",{onClickHandler:()=>{i.value=!0}},()=>[t.createVNode(d,{class:"flex-none sm:px-10 sm:py-4",onClick:c[0]||(c[0]=u=>i.value=!0)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.showPanelButtonText),1)]),_:1})])])):t.createCommentVNode("",!0),t.createElementVNode("div",IN,[t.renderSlot(l.$slots,"preview-panel")]),l.$slots["preview-panel-extra"]?(t.openBlock(),t.createElementBlock("div",AN,[t.renderSlot(l.$slots,"preview-panel-extra")])):t.createCommentVNode("",!0)],512)]),key:"3"}:void 0]),1032,["title","sticky-header","sticky-top-offset","sticky-header-on-mobile"])}}}),DN={},LN=t.defineComponent({...DN,__name:"curator-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},managerReferenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=t.computed(()=>{var m;return M.isArray(r.value)?r.value.map(g=>g.id):((m=r.value)==null?void 0:m.id)??null}),l=t.computed(()=>{const m=new j.Curator({id:-1,name:"",contacts:{},curatedDirection:new j.CuratedDirection({id:-1,name:"",guid:""}),guid:""}),g=r.showEmptyValue?[m]:[];return r.managerReferenceList.filter(b=>{var y;return(((y=b==null?void 0:b.curatedDirections)==null?void 0:y.length)??0)>0}).forEach(b=>{((b==null?void 0:b.curatedDirections)??[]).forEach(y=>{g.push(new j.Curator({id:b.id,guid:b.guid,name:b.name,photo:b.photo,contacts:b.contacts??{},curatedDirection:y}))})}),g}),c=t.computed(()=>gt.convertReferencesToSelectOptionsList(l.value,!0,{key:"item.curatedDirection.id",label:"item.curatedDirection.name"},!1,m=>{const g=M.some(s.value?r.value:[r.value],["id",m.id])?` (${m.curatedDirection.name}) `:"";return m.curatedDirection.isNewRec()?m.name:`${m.name}${g}`})),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=t.useTemplateRef("select-component"),f=m=>{if(M.isArray(m)){const g=m.length>0?m.map(b=>l.value.find(y=>y.id===b)).filter(b=>!M.isNil(b)):[];o("update:value",g)}else{const g=m>0?l.value.find(b=>b.id===m):null;o("update:value",g??null)}};return t.watch(()=>r.value,()=>{var m,g;(g=(m=u.value)==null?void 0:m.$forceUpdate)==null||g.call(m)},{deep:!0}),e({focus:()=>{var m;return(m=u.value)==null?void 0:m.focusInput()},blur:()=>{var m;return(m=u.value)==null?void 0:m.blurInput()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(F.NSelect),{ref:"select-component",value:a.value,clearable:n.clearable,disabled:c.value.length===0,"consistent-menu-width":n.consistentMenuWidth,multiple:s.value,options:d.value,placeholder:"","onUpdate:value":f},null,8,["value","clearable","disabled","consistent-menu-width","multiple","options"]))}}),HN={},WN=t.defineComponent({...HN,__name:"manager-operator-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!1},managerReferenceList:{default:()=>[]},operatorReferenceList:{default:()=>[]},showActualOnly:{type:Boolean,default:!1},groupByEmployeeType:{type:Boolean,default:!1},filterable:{type:Boolean,default:!0},maxTagCount:{default:void 0}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=t.computed(()=>{var y;return M.isArray(r.value)?r.value.filter(_=>!M.isNil(_)).map(_=>_.id):((y=r.value)==null?void 0:y.id)??null}),l=t.computed(()=>[...r.operatorReferenceList,...r.managerReferenceList]),c=t.computed(()=>{var x;const y=[];r.operatorReferenceList.length>0&&y.push({type:"group",label:"Операторы",key:"operators",children:r.operatorReferenceList.map(v=>({label:v.name,value:v.id,item:v}))});let _=r.managerReferenceList;if(r.showActualOnly){const v=M.isArray(r.value)?r.value.map(B=>B.id):[(x=r.value)==null?void 0:x.id];_=_.filter(B=>B.isActive||v.includes(B.id))}const k=gt.convertReferencesToSelectOptionsList(_,!0,{key:"item.salesDirection.id",label:"item.salesDirection.name"},!1,v=>`${v.name}${v.isActive?"":" [Не активен]"}`);return y.length>0&&k.length>0&&y.push({key:"manager-operator-divider",disabled:!0,render:()=>t.h("div",{class:"sc-manager-operator-select__divider"})}),y.push(...k),y}),d=y=>`${y.name}${"isActive"in y&&!y.isActive?" [Не активен]":""}`,u=t.computed(()=>{var B;const y=M.isArray(r.value)?r.value.map(w=>w.id):[(B=r.value)==null?void 0:B.id],_=w=>r.showActualOnly?w.filter(T=>!("isActive"in T)||T.isActive||y.includes(T.id)):w,k=[],x=_(r.managerReferenceList);x.length>0&&k.push({type:"group",label:"Менеджеры",key:"managers",children:gt.convertReferencesToSelectOptionsList(x,!0,!1,!1,d)});const v=_(r.operatorReferenceList);return v.length>0&&k.push({type:"group",label:"Операторы",key:"operators",children:gt.convertReferencesToSelectOptionsList(v,!0,!1,!1,d)}),k}),f=t.computed(()=>r.groupByEmployeeType?u.value:c.value),h=t.computed(()=>f.value.map(y=>({...y,class:r.wrapContent?`${y.class??""} consistent-menu-width`:y.class}))),p=t.useTemplateRef("select-component"),m=y=>{if(M.isArray(y)){const _=y.map(k=>l.value.find(x=>x.id===k)).filter(k=>!M.isNil(k));o("update:value",_)}else{const _=M.isNil(y)?null:l.value.find(k=>k.id===y)??null;o("update:value",_)}};return t.watch(()=>r.value,()=>{var y,_;(_=(y=p.value)==null?void 0:y.$forceUpdate)==null||_.call(y)},{deep:!0}),e({focus:()=>{var y;return(y=p.value)==null?void 0:y.focusInput()},blur:()=>{var y;return(y=p.value)==null?void 0:y.blurInput()}}),(y,_)=>(t.openBlock(),t.createBlock(t.unref(F.NSelect),{ref:"select-component",value:a.value,"clear-filter-after-select":!0,clearable:n.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled||f.value.length===0,filterable:n.filterable,"max-tag-count":n.maxTagCount,multiple:s.value,options:h.value,placeholder:"",class:"w-full","onUpdate:value":m},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),jN={},qN=t.defineComponent({...jN,__name:"manager-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!0},managerReferenceList:{default:()=>[]},disabledManagerReferenceList:{default:()=>[]},showActualOnly:{type:Boolean,default:!1},showEmptyValue:{type:Boolean,default:!1},groupBySalesDirection:{type:Boolean,default:!1}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=t.computed(()=>{var m;return M.isArray(r.value)?r.value.map(g=>g.id):((m=r.value)==null?void 0:m.id)??null}),l=t.computed(()=>r.showEmptyValue?[j.ManagerDataFactory.generateUndefinedManagerInstance(),...r.managerReferenceList]:r.managerReferenceList),c=t.computed(()=>{var b;let m=l.value,g=r.disabledManagerReferenceList.map(y=>y.id);if(r.showActualOnly){const y=M.isArray(r.value)?r.value.map(_=>_.id):[(b=r.value)==null?void 0:b.id];g=M.union(g,l.value.filter(_=>!_.isActive).map(_=>_.id)),m=m.filter(_=>(r.showEmptyValue?j.ManagerDataFactory.isUndefinedManagerInstance(_):!1)||_.isActive||y.includes(_.id))}return gt.convertReferencesToSelectOptionsList(m,!0,r.groupBySalesDirection?{key:"item.salesDirection.id",label:"item.salesDirection.name"}:!1,!1,y=>{const _=!r.groupBySalesDirection||r.groupBySalesDirection&&M.some(s.value?r.value:[r.value],["id",y.id])?` (${y.salesDirection.name}) `:"";return y.salesDirection.isNewRec()?y.name:`${y.name}${_}${y.isActive?"":" [Не активен]"}`},y=>g.includes(y.id)&&y.isActive)}),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=t.useTemplateRef("select-component"),f=m=>{if(M.isArray(m)){const g=m.length>0?m.filter(b=>!M.some(r.disabledManagerReferenceList,["id",b])).map(b=>l.value.find(y=>y.id===b)).filter(b=>!M.isNil(b)):[];o("update:value",g)}else{const g=m>0&&!M.some(r.disabledManagerReferenceList,["id",m])?l.value.find(b=>b.id===m):new j.Manager;o("update:value",g??new j.Manager)}};return t.watch(()=>r.value,()=>{var m,g;(g=(m=u.value)==null?void 0:m.$forceUpdate)==null||g.call(m)},{deep:!0}),t.watch(()=>r.disabledManagerReferenceList,m=>{if(m.length>0&&r.value)if(s.value){const g=r.value;M.some(g,b=>M.some(m,["id",b.id]))&&o("update:value",g.filter(b=>!M.some(m,["id",b.id])))}else{const g=r.value;M.some(m,["id",g.id])&&o("update:value",new j.Manager)}}),e({focus:()=>{var m;return(m=u.value)==null?void 0:m.focusInput()},blur:()=>{var m;return(m=u.value)==null?void 0:m.blurInput()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(F.NSelect),{ref:"select-component",value:a.value,clearable:n.clearable,disabled:c.value.length===0,"consistent-menu-width":n.consistentMenuWidth,multiple:s.value,options:d.value,placeholder:"","onUpdate:value":f},null,8,["value","clearable","disabled","consistent-menu-width","multiple","options"]))}}),XN={class:"m-0.5 flex flex-col p-0.5"},YN={class:"flex flex-row gap-1"},UN={key:0},KN={key:1},GN={key:2},ZN={key:3},QN={class:"flex flex-row gap-1"},JN={key:0},eT={key:1},tT={key:2},nT={key:3},iT={},bm=t.defineComponent({...iT,__name:"address-suggestion-label",props:{addr:{},selected:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",XN,[t.createElementVNode("span",YN,[n.addr.postIndex?(t.openBlock(),t.createElementBlock("span",UN,t.toDisplayString(n.addr.postIndex)+", ",1)):t.createCommentVNode("",!0),n.addr.city?(t.openBlock(),t.createElementBlock("span",KN,t.toDisplayString(n.addr.city)+", ",1)):t.createCommentVNode("",!0),n.addr.locality?(t.openBlock(),t.createElementBlock("span",GN,t.toDisplayString(n.addr.locality)+", ",1)):t.createCommentVNode("",!0),n.addr.region?(t.openBlock(),t.createElementBlock("span",ZN,t.toDisplayString(n.addr.region)+", ",1)):t.createCommentVNode("",!0)]),t.createElementVNode("span",QN,[n.addr.street?(t.openBlock(),t.createElementBlock("span",JN,t.toDisplayString(n.addr.street)+", ",1)):t.createCommentVNode("",!0),n.addr.building?(t.openBlock(),t.createElementBlock("span",eT,t.toDisplayString(n.addr.building)+", ",1)):t.createCommentVNode("",!0),n.addr.buildingPart?(t.openBlock(),t.createElementBlock("span",tT,t.toDisplayString(n.addr.buildingPart)+", ",1)):t.createCommentVNode("",!0),n.addr.apartments?(t.openBlock(),t.createElementBlock("span",nT,t.toDisplayString(n.addr.apartments)+", ",1)):t.createCommentVNode("",!0)])]))}}),bl={clearable:!1,value:"",field:void 0,disabled:!1},rT={},oT=t.defineComponent({...rT,__name:"address-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},searchDataHandler:{type:Function}},{...bl,minTermLength:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},searchDataHandler:void 0,wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=t.computed(()=>l.value.map(g=>({label:g[r.field??"addressString"]??"-",value:g.id})));t.watch(()=>r.value,g=>{s.value=g}),t.watch(s,()=>{o("update:value",s.value)});const d=M.debounce(()=>u(),800),u=async()=>{!s.value||s.value.length<r.minTermLength||(a.value=!0,l.value=await(r.searchDataHandler?r.searchDataHandler(s.value,a):j.HttpRequester.getInstance(j.DataSuggestionProvider).searchAddresses(s.value)).finally(()=>{a.value=!1}))},f=(g,b)=>{const y=l.value.find(_=>_.id===g.value)||{};return t.h(bm,{addr:y,selected:b},{default:M.constant("-")})},h=g=>{d.cancel();const b=l.value.find(y=>y.id===g)||{};o("select",b)},p=t.ref(null);function m(){p.value.focus()}return e({focus:m}),(g,b)=>{const y=F.NAutoComplete;return t.openBlock(),t.createBlock(y,{ref_key:"autoCompleteElement",ref:p,value:s.value,"onUpdate:value":[b[0]||(b[0]=_=>s.value=_),t.unref(d)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:c.value,"render-label":f,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:h},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}}),sT={class:"m-0.5 flex flex-col p-0.5"},aT={class:"font-medium"},lT={class:"flex flex-row gap-1 text-xs font-light text-blue-800"},cT={key:0},dT={key:1},uT={},_m=t.defineComponent({...uT,__name:"bank-suggestion-label",props:{bank:{},selected:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",sT,[t.createElementVNode("span",aT,t.toDisplayString(n.bank.name),1),t.createElementVNode("span",lT,[n.bank.bic?(t.openBlock(),t.createElementBlock("span",cT," БИК: "+t.toDisplayString(n.bank.bic),1)):t.createCommentVNode("",!0),n.bank.inn?(t.openBlock(),t.createElementBlock("span",dT," ИНН: "+t.toDisplayString(n.bank.inn),1)):t.createCommentVNode("",!0)])]))}}),fT={},hT=t.defineComponent({...fT,__name:"bank-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean}},{...bl,minTermLength:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=t.computed(()=>l.value.map(g=>({label:g[r.field??"_"]??"-",value:g.id})));t.watch(()=>r.value,g=>{s.value=g}),t.watch(s,()=>{o("update:value",s.value)});const d=M.debounce(()=>u(),800),u=async()=>{if(!(!s.value||s.value.length<r.minTermLength)){a.value=!0;try{l.value=await j.HttpRequester.getInstance(j.DataSuggestionProvider).searchBank(s.value)}finally{a.value=!1}}},f=(g,b)=>{const y=l.value.find(_=>_.id===g.value)||{};return t.h(_m,{bank:y,selected:b},{default:M.constant("-")})},h=g=>{d.cancel();const b=l.value.find(y=>y.id===g)||{};o("select",b)},p=t.ref(null);function m(){p.value.focus()}return e({focus:m}),(g,b)=>{const y=F.NAutoComplete;return t.openBlock(),t.createBlock(y,{ref_key:"autoCompleteElement",ref:p,value:s.value,"onUpdate:value":[b[0]||(b[0]=_=>s.value=_),t.unref(d)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:c.value,"render-label":f,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:h},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}}),mT={class:"font-medium"},pT={key:0,class:"flex flex-row gap-2"},gT={key:0,class:"text-xs font-light text-blue-800"},yT={key:1,class:"text-sc-dark-grey text-xs font-light"},bT={},wm=t.defineComponent({...bT,__name:"org-suggestion-label",props:{org:{},selected:{type:Boolean}},setup(n){const e=n,i=t.computed(()=>{var o,s;return((s=(o=e.org.rawData)==null?void 0:o.state)==null?void 0:s.liquidationDate)??!1}),r=t.computed(()=>{var o,s;return((s=(o=e.org.rawData)==null?void 0:o.address)==null?void 0:s.value)??""});return(o,s)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(`m-0.5 flex flex-col p-0.5 ${i.value?"line-through":""}`)},[t.createElementVNode("span",mT,t.toDisplayString(n.org.name),1),n.org.inn||r.value?(t.openBlock(),t.createElementBlock("div",pT,[n.org.inn?(t.openBlock(),t.createElementBlock("span",gT,t.toDisplayString(n.org.inn),1)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("span",yT,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],2))}}),_T={},wT=t.defineComponent({..._T,__name:"org-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},allowSelectTerminated:{type:Boolean}},{...bl,minTermLength:()=>{var n,e;return((e=(n=j.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=b=>{var y,_;return!!(((_=(y=b.rawData)==null?void 0:y.state)==null?void 0:_.liquidationDate)??!1)},d=t.computed(()=>gt.convertReferencesToSelectOptionsList(l.value,!1,!1,!1,b=>b[r.field??"_"]??"-",b=>!r.allowSelectTerminated&&c(b)));t.watch(()=>r.value,b=>{s.value=b}),t.watch(s,()=>{o("update:value",s.value)});const u=M.debounce(()=>f(),800),f=async()=>{if(!(!s.value||s.value.length<r.minTermLength)){a.value=!0;try{l.value=await j.HttpRequester.getInstance(j.DataSuggestionProvider).searchOrganization(s.value)}finally{a.value=!1}}},h=(b,y)=>{const _=l.value.find(k=>k.id===b.value)||{};return t.h(wm,{org:_,selected:y},{default:M.constant("-")})},p=b=>{u.cancel();const y=l.value.find(_=>_.id===b)||{};(r.allowSelectTerminated||!c(y))&&o("select",y)},m=t.ref(null);function g(){m.value.focus()}return e({focus:g}),(b,y)=>{const _=F.NAutoComplete;return t.openBlock(),t.createBlock(_,{ref_key:"autoCompleteElement",ref:m,value:s.value,"onUpdate:value":[y[0]||(y[0]=k=>s.value=k),t.unref(u)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:d.value,"render-label":h,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:p},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}});X.ALL_ORDER_MARKERS=so,X.CATEGORY_REQUIRED_HINT=Cs,X.CommonValidators=Im,X.ConfiguratorSettingsKozyrek=$u,X.ConfiguratorSettingsMosquito=Nx,X.ContentHelper=xi,X.DEFAULT_ORDER_STATUS_COLORS=vs,X.DateValidators=Am,X.EntityNameHelper=si,X.FileHelper=Mm,X.KozyrekLine=Rn,X.KozyrekTailTemplate=$a,X.KozyrekTemplate=ur,X.MODE_DISABLED_HINT=kr,X.NumericValidators=le,X.ORDER_MARKER_COLORS=Ss,X.ORDER_MARKER_NAMES=ql,X.ORDER_STATUS_COLORS=Hl,X.OrderMarkerEnum=rt,X.OrdersTableFields=Me,X.PRODUCT_REQUIRED_HINT=ks,X.Point=Ta,X.ScAddProductToCartDialog=ww,X.ScAddressSuggestion=oT,X.ScAddressSuggestionLabel=bm,X.ScBankSuggestion=hT,X.ScBankSuggestionLabel=_m,X.ScBaseDialog=Ps,X.ScButtonWithConfirmAction=zm,X.ScCategoryCollapse=Ku,X.ScChipGroup=Hm,X.ScClientNameWithShortInfo=Ir,X.ScCollapse=Uu,X.ScCollapseItem=Jl,X.ScCommentEditor=O2,X.ScCompactCardList=gC,X.ScConfiguratorsProductInfo=$r,X.ScContragentWithShortInfo=Zu,X.ScCreatorUserTypeTag=Jr,X.ScCuratorSelect=LN,X.ScDateRange=f2,X.ScDateTimeLabel=Ko,X.ScDebouncedInput=G2,X.ScDebouncedInputNumber=Q2,X.ScDebt=g2,X.ScDialogHeader=k2,X.ScDynamicConfigurator=qu,X.ScEmail=Iw,X.ScExternalLink=fC,X.ScImageGallery=rc,X.ScInlineEditableItem=yf,X.ScInlineView=Pa,X.ScKozyrekConfigurator=Eu,X.ScKozyrekConfiguratorParamsForm=lc,X.ScKozyrekConfiguratorPreview=Tu,X.ScKozyrekConfiguratorTemplates=Nu,X.ScKpiGrid=oC,X.ScLightGallery=ic,X.ScManagerOperatorSelect=WN,X.ScManagerSelect=qN,X.ScMetalForDoorsConfigurator=zu,X.ScMetalForDoorsConfiguratorForm=Ou,X.ScMosquitoConfigurator=Fu,X.ScMosquitoConfiguratorForm=Ru,X.ScMosquitoConfiguratorMeasurementInstructions=Pu,X.ScMosquitoConfiguratorPreview=Ea,X.ScOrderColorSwatch=gl,X.ScOrderCommonInfo=am,X.ScOrderDeliveryLabel=gs,X.ScOrderDetails=fm,X.ScOrderExternalLinks=hm,X.ScOrderHighlightSettings=_N,X.ScOrderInfo=mm,X.ScOrderItemParams=ml,X.ScOrderItemsList=dm,X.ScOrderPayment=pl,X.ScOrderProductInfo=lm,X.ScOrderStatusHistory=um,X.ScOrderStatusTag=cm,X.ScOrdersList=q4,X.ScOrgSuggestion=wT,X.ScOrgSuggestionLabel=wm,X.ScPage=gm,X.ScPageWithSlidingPanel=zN,X.ScPersonContactsBlock=Bx,X.ScPhone=sx,X.ScPhoneInput=tC,X.ScProductInfoContent=Rs,X.ScProductInfoDialog=oc,X.ScProductInfoPopover=sc,X.ScProductName=Tr,X.ScProductsList=j5,X.ScReferenceSelect=Gu,X.ScSandwichConfigurator=Hu,X.ScSandwichConfiguratorForm=Lu,X.ScSandwichM2Configurator=ju,X.ScSandwichM2ConfiguratorForm=Wu,X.ScSearchableProductSelect=sm,X.ScSearchableReferenceSelect=om,X.ScSetClientPriceFormItem=gw,X.ScShortTextOrderInfo=CN,X.ScSingleFileUploadSelector=W2,X.ScSlidingContentWithDrawer=ym,X.ScStripConfigurator=Au,X.ScStripConfiguratorForm=Mu,X.ScStripConfiguratorLineItem=Vu,X.ScStripConfiguratorPreview=Iu,X.ScUserShortInfo=yl,X.ScWarningIcon=U2,X.SelectOptionHelper=gt,X.UiNotificationProvider=Cr,X.Validators=He,X.WindowResolutionEnum=je,X.WindowResolutionProvider=Xe,X.channelPrimaryInterestOptionsList=rN,X.componentSizeInjectionKey=Br,X.copyToClipboard=Ol,X.deliveryTypeReferenceList=X4,X.getOrderMarkerColors=Sr,X.getOrderMarkerName=Bs,X.getOrderMarkers=Ns,X.getOrderStatusColors=wi,X.getOrderStatusCssVariables=jl,X.getOrderStatusTagColor=Wl,X.getProductInfoFiles=Ts,X.handleFloatInput=ao,X.handleIntegerInput=lt,X.hasProductInfo=Kl,X.isCanSandwichM2Show=Tx,X.isCanSandwichShow=Yu,X.isConfiguratorType=Xu,X.managersReferenceList=Y4,X.naiveUiTheme=Tp,X.operatorReferenceList=iN,X.opfReferenceList=U4,X.orderStatusDetailReferenceList=nN,X.orderStatusReferenceList=pm,X.paginationItemsPrefix=Ul,X.parse=ct,X.partnerGroupReferenceList=K4,X.paymentTypeReferenceList=tN,X.priceCoefficientsReferenceList=G4,X.productFilesTypesReferenceList=Z4,X.renderConfig=Ye,X.resetInputValidation=ot,X.resourceReferencesList=Q4,X.salesDirectionsReferenceList=J4,X.searchCityReferenceDataHandler=sN,X.searchCityReferenceLabelRenderer=aN,X.searchClientReferenceDataHandler=dN,X.searchClientReferenceLabelRenderer=uN,X.searchRegionReferenceDataHandler=lN,X.searchRegionReferenceLabelRenderer=cN,X.selectAllTextOnFocus=Le,X.showAppVersion=Vm,X.sourcePrimaryInterestOptionsList=oN,X.useCompactLayout=Rm,X.useHoverSupport=Yl,X.vCopy=zl,X.vFocusNext=oi,X.warehousesReferenceList=eN,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})}));
|