@simai-studio/ui 5.20261019.1827 → 5.20261019.1921

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.
Files changed (37) hide show
  1. package/README.md +4 -4
  2. package/distr/component/country-code/js/country-code.min.js +1 -1
  3. package/distr/component/dropdown/js/dropdown.min.js +1 -1
  4. package/distr/component/file-upload/js/file-upload.min.js +1 -1
  5. package/distr/component/inputs/js/inputs.min.js +1 -1
  6. package/distr/component/pagination/css/pagination.min.css +1 -1
  7. package/distr/component/quantity/js/quantity.min.js +1 -1
  8. package/distr/component/textarea/js/textarea.min.js +1 -1
  9. package/distr/core/contracts/adaptive-sizing.schema.json +1 -1
  10. package/distr/core/contracts/composite-host-port.v1.schema.json +1 -1
  11. package/distr/core/contracts/composition-document.v1.schema.json +1 -1
  12. package/distr/core/contracts/composition-editor-field-kind.v1.schema.json +1 -1
  13. package/distr/core/contracts/composition-editor-manifest.v1.schema.json +1 -1
  14. package/distr/core/contracts/composition-port-manifest.v1.schema.json +1 -1
  15. package/distr/core/contracts/composition-type-manifest.v1.schema.json +1 -1
  16. package/distr/core/js/core-loader.js +12 -10
  17. package/distr/core/js/core-loader.min.js +1 -1
  18. package/distr/core/js/core.js +42 -17
  19. package/distr/core/js/core.min.js +1 -1
  20. package/distr/core/js/smart-base.js +2 -2
  21. package/distr/core/js/smart-base.min.js +1 -1
  22. package/distr/smart/avatar/js/avatar.min.js +1 -1
  23. package/distr/smart/badges/js/badges.min.js +1 -1
  24. package/distr/smart/buttons/js/buttons.min.js +1 -1
  25. package/distr/smart/country-code/js/country-code.min.js +1 -1
  26. package/distr/smart/datepicker/js/datepicker.min.js +1 -1
  27. package/distr/smart/dropdown/js/dropdown.min.js +1 -1
  28. package/distr/smart/file-upload/js/file-upload.min.js +1 -1
  29. package/distr/smart/inputs/js/inputs.min.js +1 -1
  30. package/distr/smart/list-item/js/list-item.min.js +16 -16
  31. package/distr/smart/modal/contract.json +1 -1
  32. package/distr/smart/progress-scale/js/progress-scale.min.js +1 -1
  33. package/distr/smart/reference-link/js/reference-link.min.js +1 -1
  34. package/distr/smart/tags/js/tags.min.js +1 -1
  35. package/distr/smart/textarea/js/textarea.min.js +5 -5
  36. package/package-manifest.json +37 -37
  37. package/package.json +4 -4
@@ -1 +1 @@
1
- (()=>{"use strict";let e=0;function t(e,t){const n=e.querySelector('.sf-checkbox input[type="checkbox"]');if(!n)return;const o=e.querySelector(".sf-checkbox-box sf-icon, .sf-checkbox-box .sf-icon"),r="sf-icon"===o?.tagName?.toLowerCase()?o.getAttribute("icon")||"":o?.textContent;(n.checked!==t||n.indeterminate||o&&r!==(t?"check":""))&&(n.checked=t,n.indeterminate=!1,globalThis.SF?.Checkbox?.setState?.(n,{checked:t,indeterminate:!1}))}function n(t,n){if(!t.id){let o;do{o=`${n}-${++e}`}while(document.getElementById(o));t.id=o}return t.id}function o(e,o){let r=null,i=null,s=null,a=!1;const l=new WeakMap,c=(e,t,n)=>{const o=l.get(e)||{};void 0!==o[t]&&e.getAttribute(t)===o[t]&&e.removeAttribute(t),delete o[t],!e.hasAttribute(t)&&n&&(e.setAttribute(t,n),o[t]=n),l.set(e,o)},d=()=>e.querySelector(".sf-dropdown-field, .sf-dropdown-trigger"),f=()=>d()?.querySelector(":scope > button")||d(),u=()=>d()?.querySelector('input:not([type="hidden"])'),p=()=>o.getList()?.querySelector(".sf-input input"),m=()=>[...o.getList()?.querySelectorAll(".sf-list-item")||[]],h=()=>m().filter(e=>!e.hidden&&!e.classList.contains("disabled")&&"true"!==e.getAttribute("aria-disabled")&&"true"!==e.getAttribute("aria-hidden")),g=e=>e.querySelector(".sf-list-item-container, .sf-avatar-label-group-title, .sf-tag-container")?.textContent?.trim()||e.dataset.value||"",w=e=>{e&&!e.disabled&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}))},b=()=>{i="trigger",w(f()),o.close(),_()},y=e=>{if(o.isDisabled()||e.altKey||e.ctrlKey||e.metaKey)return;const t=e.target,n=t.closest?.(".sf-list-item"),r=o.getList()?.contains(t),s=t===f()||t===u()||t===d();let a=!1;if("Escape"===e.key&&o.isOpen())b(),a=!0;else{if("Tab"===e.key&&o.isOpen())return r&&w(f()),o.close(),void _();if(s&&["ArrowDown","ArrowUp","Enter"," "].includes(e.key))o.isOpen()&&["Enter"," "].includes(e.key)?b():(e=>{i=e,o.open(),_()})("ArrowUp"===e.key?"last":"search"),a=!0;else if(r&&["ArrowDown","ArrowUp"].includes(e.key)){const t=h(),o=t.indexOf(n),r=o<0?"ArrowUp"===e.key?t.length-1:0:Math.max(0,Math.min(t.length-1,o+("ArrowUp"===e.key?-1:1)));w(t[r]),a=!0}else if(n&&r&&["Home","End"].includes(e.key)){const t=h();w("Home"===e.key?t[0]:t.at(-1)),a=!0}else n&&r&&["Enter"," "].includes(e.key)&&(h().includes(n)&&(i=o.isMultiple()?{value:n.dataset.value}:"trigger",o.select(n),_()),a=!0)}a&&(e.preventDefault(),e.stopImmediatePropagation())},v=()=>{null!==s&&cancelAnimationFrame(s),s=requestAnimationFrame(()=>{var t;s=null,a||!o.isOpen()||i||(t=document.activeElement)&&(e.contains(t)||o.getList()?.contains(t))||(o.close(),_())})};let x=document.createElement("span");x.className="sf-dropdown-value",e.append(x),n(x,"sf-dropdown-value");const _=()=>{if(a)return;const s=o.getList();r!==s&&(r?.removeEventListener("keydown",y,!0),r?.removeEventListener("focusout",v),r=s,r?.addEventListener("keydown",y,!0),r?.addEventListener("focusout",v));const b=f(),_=r?.querySelector(".sf-list-container");if(!b||!_)return;x.isConnected||e.append(x);const L=e.querySelector(".sf-dropdown-label .sf-dropdown-text"),S=o.owner||e,E=L?.textContent.trim()?n(L,"sf-dropdown-label"):"",D=S.getAttribute("aria-label")||e.getAttribute("aria-label"),A=S.getAttribute("aria-labelledby")||e.getAttribute("aria-labelledby"),k=n(b,"sf-dropdown-trigger"),C=b.hasAttribute("aria-label")&&l.get(b)?.["aria-label"]!==b.getAttribute("aria-label");c(b,"aria-labelledby",A||(!D&&E?C?`${k} ${E}`:E:"")),c(b,"aria-label",D),"BUTTON"!==b.tagName&&b.setAttribute("role","button"),b.tabIndex=o.isDisabled()?-1:0,b.setAttribute("aria-expanded",String(o.isOpen())),b.setAttribute("aria-haspopup","listbox"),b.setAttribute("aria-controls",n(_,"sf-dropdown-listbox")),b.querySelectorAll(".sf-icon").forEach(e=>e.setAttribute("aria-hidden","true")),d()!==b&&(d().tabIndex=-1),u()&&(u().tabIndex=-1),_.setAttribute("role","listbox"),_.setAttribute("aria-multiselectable",String(o.isMultiple())),c(_,"aria-labelledby",A||E||k);const O=p();O&&(O.setAttribute("role","searchbox"),O.setAttribute("aria-controls",_.id),c(O,"aria-labelledby",O.hasAttribute("aria-label")?"":A||E||k)),m().forEach(e=>{e.setAttribute("role","option"),e.tabIndex=-1,e.setAttribute("aria-selected",String(e.classList.contains("selected"))),c(e,"aria-disabled",e.classList.contains("disabled")?"true":""),t(e,e.classList.contains("selected")),e.querySelectorAll(".sf-checkbox").forEach(e=>{"true"!==e.getAttribute("aria-hidden")&&e.setAttribute("aria-hidden","true")}),e.querySelectorAll(".sf-icon, sf-icon").forEach(e=>{"true"!==e.getAttribute("aria-hidden")&&e.setAttribute("aria-hidden","true")}),e.querySelectorAll("input, button, a[href], [tabindex]").forEach(e=>{e.tabIndex=-1})});const P=o.selectedLabels?.()||m().filter(e=>e.classList.contains("selected")).map(g);x.textContent=P.join(", ")||u()?.value||u()?.placeholder||"";const T=new Set((b.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean));T.add(x.id),b.setAttribute("aria-describedby",[...T].join(" ")),(()=>{if(!i)return;if("trigger"===i)return i=null,void w(f());if(!o.isOpen()||o.getList()?.hidden)return;const e=h(),t="search"===i?p()||e[0]||f():"last"===i?e.at(-1):"object"==typeof i?e.find(e=>e.dataset.value===i.value):e[0];i=null,w(t)})()};return e.addEventListener("keydown",y,!0),e.addEventListener("focusout",v),_(),{refresh:_,beforeClose:()=>{o.getList()?.contains(document.activeElement)&&(i="trigger")},release(){a=!0,null!==s&&cancelAnimationFrame(s),e.removeEventListener("keydown",y,!0),e.removeEventListener("focusout",v),r?.removeEventListener("keydown",y,!0),r?.removeEventListener("focusout",v);const t=f();if(t){const e=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(e=>e&&e!==x.id);e.length?t.setAttribute("aria-describedby",e.join(" ")):t.removeAttribute("aria-describedby")}x.remove()}}}const r=new WeakMap,i=new WeakSet;const s=Math.min,a=Math.max,l=Math.round,c=Math.floor,d=e=>({x:e,y:e}),f={left:"right",right:"left",bottom:"top",top:"bottom"};function u(e,t){return"function"==typeof e?e(t):e}function p(e){return e.split("-")[0]}function m(e){return e.split("-")[1]}function h(e){return"x"===e?"y":"x"}function g(e){return"y"===e?"height":"width"}function w(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function b(e){return h(w(e))}function y(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const v=["left","right"],x=["right","left"],_=["top","bottom"],L=["bottom","top"];function S(e,t,n,o){const r=m(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?x:v:t?v:x;case"left":case"right":return t?_:L;default:return[]}}(p(e),"start"===n,o);return r&&(i=i.map(e=>e+"-"+r),t&&(i=i.concat(i.map(y)))),i}function E(e){const t=p(e);return f[t]+e.slice(t.length)}function D(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function A(e,t,n){let{reference:o,floating:r}=e;const i=w(t),s=b(t),a=g(s),l=p(t),c="y"===i,d=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,u=o[a]/2-r[a]/2;let h;switch(l){case"top":h={x:d,y:o.y-r.height};break;case"bottom":h={x:d,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:f};break;case"left":h={x:o.x-r.width,y:f};break;default:h={x:o.x,y:o.y}}const y=m(t);return y&&(h[s]+=u*("end"===y?1:-1)*(n&&c?-1:1)),h}async function k(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:m=0}=u(t,e),h=function(e){return"number"!=typeof e?function(e){var t,n,o,r;return{top:null!=(t=e.top)?t:0,right:null!=(n=e.right)?n:0,bottom:null!=(o=e.bottom)?o:0,left:null!=(r=e.left)?r:0}}(e):{top:e,right:e,bottom:e,left:e}}(m),g=a[p?"floating"===f?"reference":"floating":f],w=D(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),b="floating"===f?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),v=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=D(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:y,strategy:l}):b);return{top:(w.top-x.top+h.top)/v.y,bottom:(x.bottom-w.bottom+h.bottom)/v.y,left:(w.left-x.left+h.left)/v.x,right:(x.right-w.right+h.right)/v.x}}const C=new Set(["left","top"]);function O(){return"undefined"!=typeof window}function P(e){return q(e)?(e.nodeName||"").toLowerCase():"#document"}function T(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function R(e){var t;return null==(t=(q(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function q(e){return!!O()&&(e instanceof Node||e instanceof T(e).Node)}function F(e){return!!O()&&(e instanceof Element||e instanceof T(e).Element)}function z(e){return!!O()&&(e instanceof HTMLElement||e instanceof T(e).HTMLElement)}function $(e){return!(!O()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof T(e).ShadowRoot)}function M(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&"inline"!==r&&"contents"!==r}function N(e){return/^(table|td|th)$/.test(P(e))}function I(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}const V=/transform|translate|scale|rotate|perspective|filter/,W=/paint|layout|strict|content/,H=e=>!!e&&"none"!==e;let B;function j(e){const t=F(e)?Y(e):e;return H(t.transform)||H(t.translate)||H(t.scale)||H(t.rotate)||H(t.perspective)||!U()&&(H(t.backdropFilter)||H(t.filter))||V.test(t.willChange||"")||W.test(t.contain||"")}function U(){return null==B&&(B="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),B}function K(e){return/^(html|body|#document)$/.test(P(e))}function Y(e){return T(e).getComputedStyle(e)}function X(e){return F(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function G(e){if("html"===P(e))return e;const t=e.assignedSlot||e.parentNode||$(e)&&e.host||R(e);return $(t)?t.host:t}function J(e){const t=G(e);return K(t)?(e.ownerDocument||e).body:z(t)&&M(t)?t:J(t)}function Q(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=J(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),s=T(r);if(i){const e=Z(s);return t.concat(s,s.visualViewport||[],M(r)?r:[],e&&n?Q(e):[])}return t.concat(r,Q(r,[],n))}function Z(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ee(e){const t=Y(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=z(e),i=r?e.offsetWidth:n,s=r?e.offsetHeight:o,a=l(n)!==i||l(o)!==s;return a&&(n=i,o=s),{width:n,height:o,$:a}}function te(e){return F(e)?e:e.contextElement}function ne(e){const t=te(e);if(!z(t))return d(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=ee(t);let s=(i?l(n.width):n.width)/o,a=(i?l(n.height):n.height)/r;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const oe=d(0);function re(e){const t=T(e);return U()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:oe}function ie(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=te(e);let s=d(1);t&&(o?F(o)&&(s=ne(o)):s=ne(e));const a=function(e,t,n){return void 0===t&&(t=!1),!!n&&t&&n===T(e)}(i,n,o)?re(i):d(0);let l=(r.left+a.x)/s.x,c=(r.top+a.y)/s.y,f=r.width/s.x,u=r.height/s.y;if(i&&o){const e=T(i),t=F(o)?T(o):o;let n=e,r=Z(n);for(;r&&t!==n;){const e=ne(r),t=r.getBoundingClientRect(),o=Y(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,s=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;l*=e.x,c*=e.y,f*=e.x,u*=e.y,l+=i,c+=s,n=T(r),r=Z(n)}}return D({width:f,height:u,x:l,y:c})}function se(e,t){const n=X(e).scrollLeft;return t?t.left+n:ie(R(e)).left+n}function ae(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-se(e,n),y:n.top+t.scrollTop}}function le(e,t,n){let o;if("viewport"===t||"layoutViewport"===t)o=function(e,t,n){void 0===n&&(n="viewport");const o="layoutViewport"===n,r=T(e),i=R(e),s=r.visualViewport;let a=i.clientWidth,l=i.clientHeight,c=0,d=0;if(s){const e=!U()||"fixed"===t;o?e||(c=-s.offsetLeft,d=-s.offsetTop):(a=s.width,l=s.height,e&&(c=s.offsetLeft,d=s.offsetTop))}if(se(i)<=0){const e=i.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,r=Math.abs(i.clientWidth-t.clientWidth-o),s="stable both-edges"===getComputedStyle(i).scrollbarGutter?r/2:r;s<=25&&(a-=s)}return{width:a,height:l,x:c,y:d}}(e,n,t);else if("document"===t)o=function(e){const t=X(e),n=e.ownerDocument.body,o=a(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=a(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+se(e);const s=-t.scrollTop;return"rtl"===Y(n).direction&&(i+=a(e.clientWidth,n.clientWidth)-o),{width:o,height:r,x:i,y:s}}(R(e));else if(F(t))o=function(e,t){const n=ie(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=ne(e);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:o*i.y}}(t,n);else{const n=re(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return D(o)}function ce(e,t,n){const o=z(t),r=R(t),i="fixed"===n,s=ie(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=d(0);if((o||!i)&&(("body"!==P(t)||M(r))&&(a=X(t)),o)){const e=ie(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!o&&r&&(l.x=se(r));const c=!r||o||i?d(0):ae(r,a);return{x:s.left+a.scrollLeft-l.x-c.x,y:s.top+a.scrollTop-l.y-c.y,width:s.width,height:s.height}}function de(e){return"static"===Y(e).position}function fe(e,t){if(!z(e)||"fixed"===Y(e).position)return null;if(t)return t(e);let n=e.offsetParent;return R(e)===n&&(n=n.ownerDocument.body),n}function ue(e,t){const n=T(e);if(I(e))return n;if(!z(e)){let t=G(e);for(;t&&!K(t);){if(F(t)&&!de(t))return t;t=G(t)}return n}let o=fe(e,t);for(;o&&N(o)&&de(o);)o=fe(o,t);return o&&K(o)&&de(o)&&!j(o)?n:o||function(e){let t=G(e);for(;z(t)&&!K(t);){if(j(t))return t;if(I(t))return null;t=G(t)}return null}(e)||n}const pe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,s=R(o),a=!!t&&I(t.floating);if(o===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=d(1);const f=d(0),u=z(o);if((u||!i)&&(("body"!==P(o)||M(s))&&(l=X(o)),u)){const e=ie(o);c=ne(o),f.x=e.x+o.clientLeft,f.y=e.y+o.clientTop}const p=!s||u||i?d(0):ae(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+p.x,y:n.y*c.y-l.scrollTop*c.y+f.y+p.y}},getDocumentElement:R,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[..."clippingAncestors"===n?I(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=Q(e,[],!1).filter(e=>F(e)&&"body"!==P(e)),r=null;const i="fixed"===Y(e).position;let s=i?G(e):e;for(;F(s)&&!K(s);){const e=Y(s),t=j(s),n=r?r.position:i?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?r=e:o=o.filter(e=>e!==s),s=G(s)}return t.set(e,o),o}(t,this._c):[].concat(n),o],l=le(t,i[0],r);let c=l.top,d=l.right,f=l.bottom,u=l.left;for(let e=1;e<i.length;e++){const n=le(t,i[e],r);c=a(n.top,c),d=s(n.right,d),f=s(n.bottom,f),u=a(n.left,u)}return{width:d-u,height:f-c,x:u,y:c}},getOffsetParent:ue,getElementRects:async function(e){const t=this.getOffsetParent||ue,n=this.getDimensions,o=await n(e.floating);return{reference:ce(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){const{width:t,height:n}=ee(e);return{width:t,height:n}},getScale:ne,isElement:F,isRTL:function(e){return"rtl"===Y(e).direction}};function me(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function he(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:d="function"==typeof IntersectionObserver,animationFrame:f=!1}=o,u=te(e),p=r||i?[...u?Q(u):[],...t?Q(t):[]]:[];p.forEach(e=>{r&&e.addEventListener("scroll",n),i&&e.addEventListener("resize",n)});const m=u&&d?function(e,t,n){let o,r=null;const i=R(e);function l(){var e;clearTimeout(o),null==(e=r)||e.disconnect(),r=null}function d(n,f){void 0===n&&(n=!1),void 0===f&&(f=1),l();const u=e.getBoundingClientRect(),{left:p,top:m,width:h,height:g}=u;if(n||t(),!h||!g)return;const w={rootMargin:-c(m)+"px "+-c(i.clientWidth-(p+h))+"px "+-c(i.clientHeight-(m+g))+"px "+-c(p)+"px",threshold:a(0,s(1,f))||1};let b=!0;function y(t){const n=t[0].intersectionRatio;if(!me(u,e.getBoundingClientRect()))return d();if(n!==f){if(!b)return d();n?d(!1,n):o=setTimeout(()=>{d(!1,1e-7)},1e3)}b=!1}try{r=new IntersectionObserver(y,{...w,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(y,w)}r.observe(e)}const f=T(e),u=()=>d(n);return f.addEventListener("resize",u),d(!0),()=>{f.removeEventListener("resize",u),l()}}(u,n,i):null;let h,g=-1,w=null;l&&(w=new ResizeObserver(e=>{let[o]=e;o&&o.target===u&&w&&t&&(w.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var e;null==(e=w)||e.observe(t)})),n()}),u&&!f&&w.observe(u),t&&w.observe(t));let b=f?ie(e):null;return f&&function t(){const o=ie(e);b&&!me(b,o)&&n();b=o,h=requestAnimationFrame(t)}(),n(),()=>{var e;p.forEach(e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==m||m(),null==(e=w)||e.disconnect(),w=null,f&&cancelAnimationFrame(h)}}const ge=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:s,middlewareData:a}=t,l=await async function(e,t){const{placement:n,platform:o,elements:r}=e,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),s=p(n),a=m(n),l="y"===w(n),c=C.has(s)?-1:1,d=i&&l?-1:1,f=u(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:b}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&"number"==typeof b&&(g="end"===a?-1*b:b),l?{x:g*d,y:h*c}:{x:h*c,y:g*d}}(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(o=a.arrow)&&o.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:s}}}}},we=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:i}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:d={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...f}=u(e,t),p={x:n,y:o},m=await i.detectOverflow(t,f),g=w(r),b=h(g);let y=p[b],v=p[g];const x=(e,t)=>{return n=t+m["y"===e?"top":"left"],o=t,r=t-m["y"===e?"bottom":"right"],a(n,s(o,r));var n,o,r};l&&(y=x(b,y)),c&&(v=x(g,v));const _=d.fn({...t,[b]:y,[g]:v});return{..._,data:{x:_.x-n,y:_.y-o,enabled:{[b]:l,[g]:c}}}}}},be=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:_=!0,...L}=u(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const D=p(r),A=w(a),k=p(a)===a,C=await(null==l.isRTL?void 0:l.isRTL(c.floating)),O=h||(k||!_?[E(a)]:function(e){const t=E(e);return[y(e),t,y(t)]}(a)),P="none"!==x;!h&&P&&O.push(...S(a,_,x,C));const T=[a,...O],R=await l.detectOverflow(t,L),q=[];let F=(null==(o=i.flip)?void 0:o.overflows)||[];if(d&&q.push(R[D]),f){const e=function(e,t,n){void 0===n&&(n=!1);const o=m(e),r=b(e),i=g(r);let s="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=E(s)),[s,E(s)]}(r,s,C);q.push(R[e[0]],R[e[1]])}if(F=[...F,{placement:r,overflows:q}],!q.every(e=>e<=0)){var z,$;const e=((null==(z=i.flip)?void 0:z.index)||0)+1,t=T[e];if(t){if(!("alignment"===f&&A!==w(t))||F.every(e=>w(e.placement)!==A||e.overflows[0]>0))return{data:{index:e,overflows:F},reset:{placement:t}}}let n=null==($=F.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:$.placement;if(!n)switch(v){case"bestFit":{var M;const e=null==(M=F.filter(e=>{if(P){const t=w(e.placement);return t===A||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:M[0];e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}},ye=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:r,elements:i}=t,{apply:l=()=>{},...c}=u(e,t),d=await r.detectOverflow(t,c),f=p(n),h=m(n),g="y"===w(n),{width:b,height:y}=o.floating;let v,x;"top"===f||"bottom"===f?(v=f,x=h===(await(null==r.isRTL?void 0:r.isRTL(i.floating))?"start":"end")?"left":"right"):(x=f,v="end"===h?"top":"bottom");const _=y-d.top-d.bottom,L=b-d.left-d.right,S=s(y-d[v],_),E=s(b-d[x],L),D=t.middlewareData.shift,A=!D;let k=S,C=E;null!=D&&D.enabled.x&&(C=L),null!=D&&D.enabled.y&&(k=_),A&&!h&&(g?C=b-2*a(d.left,d.right):k=y-2*a(d.top,d.bottom)),await l({...t,availableWidth:C,availableHeight:k});const O=await r.getDimensions(i.floating);return b!==O.width||y!==O.height?{reset:{rects:!0}}:{}}}},ve=(e,t,n)=>{const o=new Map,r=null!=n?n:{},i={...pe,...r.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:k},l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:f}=A(c,o,l),u=o,p=0;const m={};for(let n=0;n<i.length;n++){const h=i[n];if(!h)continue;const{name:g,fn:w}=h,{x:b,y,data:v,reset:x}=await w({x:d,y:f,initialPlacement:o,placement:u,strategy:r,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=b?b:d,f=null!=y?y:f,m[g]={...m[g],...v},x&&p<50&&(p++,"object"==typeof x&&(x.placement&&(u=x.placement),x.rects&&(c=!0===x.rects?await s.getElementRects({reference:e,floating:t,strategy:r}):x.rects),({x:d,y:f}=A(c,u,l))),n=-1)}return{x:d,y:f,placement:u,strategy:r,middlewareData:m}})(e,t,{...r,platform:i})},xe=["block-start","block-end","inline-start","inline-end"],_e=["start","center","end"];function Le(e="block-end",t="start",n=!1){if(!xe.includes(e))throw new TypeError(`Unknown placement side: ${e}`);if(!_e.includes(t))throw new TypeError(`Unknown placement alignment: ${t}`);const o="block-start"===e?"top":"block-end"===e?"bottom":"inline-start"===e?n?"right":"left":n?"left":"right";return"center"===t?o:`${o}-${t}`}function Se(e,t=!1){const n=String(e).split("-")[0];return"top"===n?"block-start":"bottom"===n?"block-end":"left"===n?t?"inline-end":"inline-start":t?"inline-start":"inline-end"}function Ee(e,t=document.body){if("number"==typeof e)return Number.isFinite(e)?e:0;if("string"!=typeof e||""===e.trim())return 0;const n=document.createElement("span");n.style.cssText="position:absolute;visibility:hidden;pointer-events:none;block-size:0;padding:0;border:0",n.style.inlineSize=e,(t?.isConnected?t:document.body).append(n);const o=parseFloat(getComputedStyle(n).width)||0;return n.remove(),o}const De=Object.freeze({anchor:function(e,t,n={}){if(!(e instanceof Element&&t instanceof HTMLElement))throw new TypeError("Anchored positioning needs a reference element and a floating element");const o={side:"block-end",align:"start",offset:"var(--sf-space-1\\/4)",alignmentOffset:0,padding:"var(--sf-space-1\\/2)",flip:!0,shift:!0,matchWidth:!1,fitHeight:!0,autoUpdate:!0,onPosition:null,...n},r=["position","left","top","right","bottom","margin","max-height","max-width",...o.matchWidth?["width"]:[]].map(e=>[e,t.style.getPropertyValue(e),t.style.getPropertyPriority(e)]),i={maxHeight:t.style.getPropertyValue("max-height")},s=getComputedStyle(t),a=(e,t)=>{const n=parseFloat(e);return Number.isFinite(n)?String(e).trim().endsWith("%")?n/100*t:n:1/0},l=a(s.maxHeight,document.documentElement.clientHeight),c=a(s.maxWidth,document.documentElement.clientWidth),d={side:o.side,stopped:!1};let f=null,u=!1;const p=async()=>{const n="rtl"===getComputedStyle(e).direction;const r=Ee(o.offset,e.parentElement),s=Ee(o.padding,e.parentElement);o.fitHeight&&(t.style.maxHeight=i.maxHeight||"");const a=e.getBoundingClientRect(),f=document.documentElement.clientWidth,u={top:s,bottom:s,left:Math.min(s,Math.max(0,a.left)),right:Math.min(s,Math.max(0,f-a.right))},p=[ge({mainAxis:r,alignmentAxis:Ee(o.alignmentOffset,e.parentElement)})];o.flip&&p.push(be({padding:s,crossAxis:!1})),o.shift&&p.push(we({padding:u,crossAxis:!1})),p.push(ye({padding:u,apply({availableWidth:e,availableHeight:t,rects:n,elements:r}){if(d.stopped)return;const i=f-u.left-u.right;o.matchWidth&&(r.floating.style.width=`${Math.max(0,Math.min(n.reference.width,i))}px`),r.floating.style.maxWidth=`${Math.max(0,Math.min(e,i,c))}px`,o.fitHeight&&(r.floating.style.maxHeight=`${Math.max(0,Math.min(t,l))}px`)}}));const m=await ve(e,t,{strategy:"fixed",placement:Le(o.side,o.align,n),middleware:p});return d.stopped||(Object.assign(t.style,{position:"fixed",left:`${m.x}px`,top:`${m.y}px`,right:"auto",bottom:"auto",margin:"0"}),d.side=Se(m.placement,n),t.dataset.sfSide=d.side,o.onPosition?.({side:d.side,placement:m.placement,x:m.x,y:m.y})),m};d.update=()=>d.stopped?Promise.resolve(null):f?(u=!0,f):(f=p().finally(()=>{f=null,u&&!d.stopped&&(u=!1,d.update())}),f);const m=o.autoUpdate?he(e,t,d.update):null;return d.stop=()=>{d.stopped=!0,m?.(),delete t.dataset.sfSide;for(const[e,n,o]of r)n?t.style.setProperty(e,n,o):t.style.removeProperty(e)},o.autoUpdate||d.update(),d},logicalSide:Se,physicalPlacement:Le,resolveLength:Ee});"undefined"!=typeof globalThis&&(globalThis.SF=globalThis.SF||{},globalThis.SF.Position||(globalThis.SF.Position=De));const Ae=De,ke=new WeakMap,Ce=["position","inset","margin","width","max-width","max-height","overflow","left","top","right","bottom","z-index"],Oe=["font-family","font-size","font-weight","font-style","font-stretch","font-variant","font-feature-settings","font-variation-settings","font-optical-sizing","font-kerning","line-height","letter-spacing","word-spacing","text-transform","text-indent","white-space","word-break","overflow-wrap","text-rendering","direction","writing-mode","text-orientation","color","color-scheme","text-align"];function Pe(e,t){if(!t.context)return;const n=t.context,o=getComputedStyle(e),r=["sf-dropdown",...Array.from(e.classList).filter(e=>e.startsWith("sf-dropdown--")&&!["sf-dropdown--open","sf-dropdown--drop-up","sf-dropdown--drop-down"].includes(e))].join(" ");n.className!==r&&(n.className=r);const i=[...Array.from(o).filter(e=>e.startsWith("--sf-")),...Oe],s=new Set(i);for(const e of t.contextProperties||[])s.has(e)||n.style.removeProperty(e);for(const e of i){const t=o.getPropertyValue(e);n.style.getPropertyValue(e)!==t&&n.style.setProperty(e,t)}t.contextProperties=i}function Te(e){return e?.querySelector(".sf-dropdown-field, .sf-dropdown-trigger")??null}function Re(e,t){const n=ke.get(t);if(!n||!e.isConnected||t.hidden)return!1;const o=Te(e);return!!o&&(e.closest('[hidden], [inert], [aria-hidden="true"], dialog:not([open])')||!o.getClientRects().length||["hidden","collapse"].includes(getComputedStyle(o).visibility)?(n.onUnavailable?.(),!1):(Pe(e,n),n.wrap&&(n.wrap.style.minHeight="0",n.wrap.style.overflowY="auto"),n.anchor||(n.anchor=(globalThis.SF?.Position||Ae).anchor(o,t,{side:"block-end",align:"start",matchWidth:o.classList.contains("sf-dropdown-field"),fitHeight:!0,autoUpdate:!1,onPosition:({side:n})=>{const o="block-start"===n;t.dataset.placement=e.dataset.placement=o?"top":"bottom",e.classList.toggle("sf-dropdown--drop-up",o),e.classList.toggle("sf-dropdown--drop-down",!o)}})),n.anchor.update(),!0))}function qe(){const e=globalThis.SF=globalThis.SF||{};return e.__deprecationNotes instanceof Map||Object.defineProperty(e,"__deprecationNotes",{value:new Map,configurable:!0}),e.__deprecationNotes}function Fe({component:e="",kind:t="attribute",attribute:n="",from:o,to:r=null}={}){if(!o)return;const i=[e,t,n,o].join("|"),s=qe(),a=s.get(i);if(a)a.count+=1;else if(s.set(i,{component:e,kind:t,attribute:n,from:o,to:r,count:1}),function(){const e=globalThis.document?.documentElement;return"warn"===e?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const i=e?`${e}: `:"",s="value"===t?`${n}="${o}"`:`${t} ${o}`;globalThis.console?.warn?.(`[Simai Framework] ${i}${s} is a legacy name${r?`; write ${r}`:""}. See contracts/changes/journal.json.`)}}if("undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const e=globalThis.SF.deprecations||{};e.list=function(){return[...qe().values()].map(e=>({...e}))},e.clear=function(){qe().clear()},e.note=Fe,globalThis.SF.deprecations=e}const ze=Object.freeze(["1/2","1","2"]),$e=Object.freeze({"1/3":"1/2",3:"2"}),Me=new Set;function Ne(e,t="field",n="1"){const o=String(e??"").trim().toLowerCase();if(ze.includes(o))return o;if(Object.hasOwn($e,o)){const e=$e[o];Fe({component:t,kind:"value",attribute:"size",from:o,to:e});const n=`${t}:${o}`;return Me.has(n)||"undefined"==typeof console||(Me.add(n),console.warn(`[Simai Framework] ${t}: size ${o} is retired for form fields; rendering size ${e}.`)),e}return n}const Ie=".sf-dropdown",Ve="sfDropdownBound",We=".sf-list-item-selected-item",He=Object.freeze({"1/2":{size:"1/3",spacing:""},1:{size:"1",spacing:"compact"},2:{size:"2",spacing:"compact"}});function Be(e){return e.classList.contains("sf-dropdown--tag")}function je(e){const t=e?.closest?.("sf-dropdown");return Boolean(t?.__sfSmartElement)}function Ue(e,t=!1){return null==e||""===e?t:"boolean"==typeof e?e:["1","true","yes","on"].includes(String(e).toLowerCase())}function Ke(e){return!!e&&(e.hasAttribute("multiple")?Ue(e.getAttribute("multiple"),!0):void 0!==e.dataset.multiple?Ue(e.dataset.multiple,!1):Be(e))}function Ye(e){return!!e&&(!!e.classList.contains("disabled")||!!e.hasAttribute("disabled")&&Ue(e.getAttribute("disabled"),!0))}function Xe(e){return!!e&&(e.hasAttribute("portal")?Ue(e.getAttribute("portal"),!0):void 0===e.dataset.portal||Ue(e.dataset.portal,!0))}function Ge(e){return e.querySelector(".sf-dropdown-field")}function Je(e){return e.querySelector(".sf-dropdown-field input:not(.sf-dropdown-hidden-input)")}function Qe(e){return e.__sfDropdownPortalList||e.querySelector(".sf-list")}function Ze(e){return Qe(e)?.querySelector(".sf-input input")||null}function et(e){return e.querySelector(".sf-dropdown-hidden-input")}function tt(e){return Qe(e)?.querySelector(".sf-list-container")||null}function nt(e){return Array.from(Qe(e)?.querySelectorAll(".sf-list-item")||[])}function ot(e,t){return!(!e||!t)&&(!!e.contains(t)||Boolean(e.__sfDropdownPortalList?.contains(t)))}function rt(e){e&&Xe(e)&&Re(e,Qe(e))}function it(e){if(!e||!Xe(e))return;const t=Qe(e);t&&function(e,t,n){if(!t?.isConnected||!Te(e))return!1;const o=t.contains(document.activeElement)?document.activeElement:null;if(!ke.has(t)){const o=Ce.map(e=>[e,t.style.getPropertyValue(e),t.style.getPropertyPriority(e)]),r={root:e,saved:o,onUnavailable:n,popover:t.getAttribute("popover"),frame:0,native:"function"==typeof t.showPopover};r.wrap=t.querySelector(".sf-list-container-wrap"),r.wrapStyles=r.wrap?["min-height","overflow-y"].map(e=>[e,r.wrap.style.getPropertyValue(e),r.wrap.style.getPropertyPriority(e)]):[],r.schedule=()=>{r.frame||(r.frame=requestAnimationFrame(()=>{r.frame=0,Re(e,t)}))},ke.set(t,r),e.__sfDropdownPortalList=t,r.native?t.setAttribute("popover","manual"):(r.parent=t.parentNode,r.next=t.nextSibling,r.context=document.createElement("div"),r.context.style.cssText="display:contents;position:static",Pe(e,r),(e.closest('dialog[open], [role="dialog"][aria-modal="true"]')||document.body).append(r.context),r.context.append(t),t.style.zIndex="var(--sf-z-index-9)"),r.inheritance=new MutationObserver(r.schedule);for(let t=e;t;t=t.parentElement)r.inheritance.observe(t,{attributes:!0,attributeFilter:["class","style","dir","hidden","inert","aria-hidden","open"]});Object.assign(t.style,{position:"fixed",inset:"auto",margin:"0",overflow:r.wrap?"hidden":"auto"}),"function"==typeof ResizeObserver&&(r.resize=new ResizeObserver(r.schedule),r.resize.observe(Te(e)),r.resize.observe(t)),window.visualViewport?.addEventListener("resize",r.schedule),window.visualViewport?.addEventListener("scroll",r.schedule)}return t.hidden=!1,ke.get(t).native&&!t.matches(":popover-open")&&t.showPopover(),!!Re(e,t)&&(o&&document.activeElement!==o&&o.focus({preventScroll:!0}),!0)}(e,t,()=>bt(e))&&(t.__sfDropdownRoot=e,e.__sfDropdownPortalClick||(e.__sfDropdownPortalClick=St,e.__sfDropdownPortalKeydown=Et,t.addEventListener("click",St),t.addEventListener("keydown",Et)),e.__sfDropdownPortalOnViewportChange||(e.__sfDropdownPortalOnViewportChange=()=>{e.classList.contains("sf-dropdown--open")&&rt(e)}),window.addEventListener("resize",e.__sfDropdownPortalOnViewportChange),document.addEventListener("scroll",e.__sfDropdownPortalOnViewportChange,!0))}function st(e){if(!e)return;const t=Qe(e);!function(e){const t=ke.get(e);if(!t)return!1;const n=e.contains(document.activeElement)?document.activeElement:null;t.anchor?.stop(),t.resize?.disconnect(),cancelAnimationFrame(t.frame),t.inheritance?.disconnect(),window.visualViewport?.removeEventListener("resize",t.schedule),window.visualViewport?.removeEventListener("scroll",t.schedule),t.native?(e.matches(":popover-open")&&e.hidePopover(),null===t.popover?e.removeAttribute("popover"):e.setAttribute("popover",t.popover)):(t.next?.parentNode===t.parent?t.parent.insertBefore(e,t.next):t.parent.append(e),t.context.remove());for(const[n,o,r]of t.saved)o?e.style.setProperty(n,o,r):e.style.removeProperty(n);for(const[e,n,o]of t.wrapStyles)n?t.wrap.style.setProperty(e,n,o):t.wrap.style.removeProperty(e);delete e.dataset.placement,delete t.root.dataset.placement,t.root.classList.remove("sf-dropdown--drop-up","sf-dropdown--drop-down"),t.root.__sfDropdownPortalList===e&&delete t.root.__sfDropdownPortalList,ke.delete(e),n&&!e.hidden&&t.root.isConnected&&document.activeElement!==n&&n.focus({preventScroll:!0})}(t),t&&e.__sfDropdownPortalClick&&(t.removeEventListener("click",e.__sfDropdownPortalClick),t.removeEventListener("keydown",e.__sfDropdownPortalKeydown)),delete e.__sfDropdownPortalClick,delete e.__sfDropdownPortalKeydown,e.__sfDropdownPortalOnViewportChange&&(window.removeEventListener("resize",e.__sfDropdownPortalOnViewportChange),document.removeEventListener("scroll",e.__sfDropdownPortalOnViewportChange,!0)),t&&delete t.__sfDropdownRoot,delete e.__sfDropdownPortalOnViewportChange}function at(e){return e?.dataset?.value??lt(e)}function lt(e){if(!e)return"";const t=e.querySelector(".sf-list-item-container")?.textContent?.trim();if(t)return t;const n=e.querySelector(".sf-tag-container")?.textContent?.trim();if(n)return n;const o=e.querySelector(".sf-avatar-label-group-title")?.textContent?.trim();return o||(e.dataset?.value?.trim?.()||e.textContent?.trim()||"")}function ct(e,n=[]){const o=new Set(n);nt(e).forEach(e=>{const n=o.has(e);e.classList.toggle("selected",n),e.setAttribute("aria-selected",n?"true":"false");const r=e.querySelector(We);n?function(e){if(!e.classList.contains("sf-list-item--text")&&!e.classList.contains("sf-list-item--icon"))return;if(!e||e.querySelector(We))return;const t=document.createElement("div");t.className="sf-list-item-selected-item flex";const n=document.createElement("i");n.className="sf-icon",n.textContent="check",t.append(n),e.append(t)}(e):r&&r.remove(),t(e,n)}),e.__sfDropdownInteraction?.refresh()}function dt(e){nt(e).forEach(t=>{const n=t.querySelector(".sf-checkbox"),o=t.querySelector(".sf-checkbox input");n&&o&&(o.tabIndex=-1,o.dataset.dropdownManaged="1",o.style.pointerEvents="none",n.style.pointerEvents="none",Ye(e)||t.classList.contains("disabled")?o.disabled=!0:o.disabled=!1)})}function ft(e){if(!Be(e))return;const t=function(e){return e.querySelector(".sf-dropdown-tag-container")}(e);t&&(t.innerHTML="",nt(e).filter(e=>e.classList.contains("selected")).forEach(n=>{t.append(function(e,t){const n=at(t),o=lt(t),r=e.className.match(/sf-dropdown--size-([^\s]+)/)?.[1]||"1",i=He[r]||He[1],s=i.size,a=i.spacing?` spacing-${i.spacing}`:"",l=t.classList.contains("sf-list-item--icon"),c=t.classList.contains("sf-list-item--avatar"),d=t.classList.contains("sf-list-item--color"),f=Ye(e),u=d?"color":c?"avatar":"icon",p=document.createElement("div");p.className=`sf-tag transition sf-tag--${u} sf-tag--size-${s} sf-tag--inline${a} flex flex-row flex-nowrap items-center active`,p.dataset.value=n,f&&(p.classList.add("disabled"),p.setAttribute("aria-disabled","true"));const m=document.createElement("span");if(m.className="sf-tag-container",m.textContent=o,d){const e=t.querySelector(".sf-tag-color-icon"),n=document.createElement("span");n.className=e?.className||"sf-tag-color-icon",p.append(n)}else if(c){const e=t.querySelector(".sf-avatar");e&&p.append(e.cloneNode(!0))}else if(l){const e=document.createElement("i");e.className="sf-icon sf-tag-icon",e.textContent=t.querySelector(".sf-list-item-wrap > .sf-icon")?.textContent?.trim()||"favorite",p.append(e)}p.append(m);const h=document.createElement("button");h.type="button",h.className="sf-icon-button sf-icon-button--link sf-icon-button--on-surface sf-icon-button--size-1/3",h.setAttribute("aria-label",`Remove ${o}`),h.dataset.role="remove-tag",h.dataset.value=n,h.disabled=f,h.tabIndex=f?-1:0;const g=document.createElement("div");g.className="sf-close sf-close--size-1/3 flex";const w=document.createElement("div");return w.className="sf-close-icon",g.append(w),h.append(g),p.append(h),p}(e,n))}))}function ut(e){const t=et(e);t&&(t.value=Ke(e)?vt(e).map(at).join(","):e.dataset.selectedValue||"",t.disabled=Ye(e))}const pt=":scope > .sf-list-item-wrap :is(.sf-flag, .sf-icon, .sf-tag-color-icon, .sf-avatar):not(.sf-checkbox *)";function mt(e){const t=vt(e),n=Ke(e)?t:t.slice(0,1);!function(e,t){if(Be(e))return;const n=Je(e);n&&(n.value=t)}(e,n.map(lt).join(", ")),function(e,t){if(Be(e))return;const n=Ge(e),o=Je(e);if(!n||!o)return;if(n.querySelector(":scope > .sf-dropdown-field-visual")?.remove(),Ke(e)||1!==t.length)return;const r=t[0].querySelector(pt);if(!r)return;const i=r.cloneNode(!0);i.classList.add("sf-dropdown-field-visual"),i.setAttribute("aria-hidden","true"),i.classList.contains("sf-flag")&&(delete i.dataset.sfFlagReady,i.replaceChildren()),o.before(i)}(e,n),e.dataset.selectedValue=n.map(at).join(","),ft(e),ut(e)}function ht(e,t){const n=function(e){return e.querySelector(".sf-dropdown-field .sf-icon-button .sf-icon")}(e);n&&(n.textContent=t?"keyboard_arrow_up":"keyboard_arrow_down")}function gt(e,t=4){const n=function(e){return Qe(e)?.querySelector(".sf-list-container-wrap")||null}(e),o=tt(e);if(!n||!o||t<=0)return;const r=nt(e).filter(e=>!e.hidden);if(!r.length)return;const i=r[0].getBoundingClientRect().height;if(!i)return;const s=window.getComputedStyle(o),a=Number.parseFloat(s.rowGap||"")||Number.parseFloat(s.gap||"")||0,l=Number.parseFloat(s.paddingTop||"")||0,c=Number.parseFloat(s.paddingBottom||"")||0,d=Math.min(t,r.length),f=d*i+Math.max(d-1,0)*a+l+c;n.style.maxHeight=`${Math.ceil(f)}px`,n.style.overflowY=r.length>d?"auto":"hidden",n.style.overflowX="hidden"}function wt(e){if(!e||Ye(e))return;const t=Je(e);if(t&&t.disabled)return;const n=Qe(e);n&&(e.classList.add("sf-dropdown--open"),it(e),n.hidden=!1,ht(e,!0),gt(e,4),rt(e),e.__sfDropdownInteraction?.refresh())}function bt(e){if(!e)return;if(je(e))return void e.closest("sf-dropdown").closeDropdown();e.__sfDropdownInteraction?.beforeClose();const t=Qe(e);if(!t)return;e.classList.remove("sf-dropdown--open"),t.hidden=!0,ht(e,!1),st(e);const n=Ze(e);n&&(n.value="",yt(e,"")),e.__sfDropdownInteraction?.refresh()}function yt(e,t=""){const n=String(t).trim().toLowerCase();nt(e).forEach(e=>{const t=lt(e).toLowerCase();e.hidden=Boolean(n)&&!t.includes(n)}),gt(e,4),e.__sfDropdownInteraction?.refresh(),e.classList.contains("sf-dropdown--open")&&rt(e)}function vt(e){return nt(e).filter(e=>e.classList.contains("selected"))}function xt(e){const t=Ye(e),n=e.__sfDropdownDisabledState!==t;e.__sfDropdownDisabledState=t;const o=Ge(e),r=Je(e),i=Ze(e),s=e.querySelector(".sf-dropdown-field .sf-icon-button");e.removeAttribute("aria-disabled");const a=o?.querySelector(":scope > button")||o;a&&"BUTTON"!==a.tagName&&a.setAttribute("aria-disabled",t?"true":"false"),o&&o.classList.toggle("cursor-pointer",!t),r&&(r.disabled=t),i&&(i.disabled=t);const l=et(e);return l&&(l.disabled=t),s&&(s.disabled=t,s.tabIndex=t?-1:0),nt(e).forEach(e=>{e.tabIndex=t||e.classList.contains("disabled")?-1:0}),t&&e.classList.contains("sf-dropdown--open")&&bt(e),e.__sfDropdownInteraction?.refresh(),n}function _t(e,t){e&&(e.dispatchEvent(new CustomEvent("sf-dropdown:change",{bubbles:!0,composed:!0,detail:t})),e.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:t})))}function Lt(e,t){if(!e||!t||t.classList.contains("disabled")||Ye(e))return;const n=lt(t),o=at(t),r=Ke(e);if(r){const n=vt(e);ct(e,t.classList.contains("selected")?n.filter(e=>e!==t):[...n,t])}else ct(e,[t]);mt(e),_t(e,{value:o,label:n,values:r?vt(e).map(at):[o],item:t,root:e,multiple:r}),dt(e),r||bt(e)}function St(e){const t=e.currentTarget.__sfDropdownRoot||e.currentTarget;if(e.currentTarget!==t&&t.contains(e.currentTarget))return;if(Ye(t))return void e.preventDefault();const n=Ge(t),o=e.target.closest(".sf-list-item"),r=e.target.closest('[data-role="remove-tag"]'),i=e.target.closest(".sf-list .sf-input"),s=e.target.closest(".sf-list-item .sf-checkbox");if(!i||!ot(t,i)){if(s&&ot(t,s)&&e.preventDefault(),r&&ot(t,r)){e.preventDefault(),e.stopPropagation();const n=r.dataset.value,o=vt(t).filter(e=>at(e)!==n);return ct(t,o),mt(t),_t(t,{value:"",label:"",values:o.map(at),item:null,root:t,multiple:Ke(t)}),void dt(t)}if(o&&ot(t,o))return e.preventDefault(),void Lt(t,o);n?.contains(e.target)&&(e.target.closest(".sf-list")||(e.preventDefault(),function(e){e&&(e.classList.contains("sf-dropdown--open")?bt(e):(document.querySelectorAll(`${Ie}.sf-dropdown--open`).forEach(t=>{t!==e&&bt(t)}),wt(e)))}(t)))}}function Et(e){const t=e.currentTarget.__sfDropdownRoot||e.currentTarget;if(e.currentTarget!==t&&t.contains(e.currentTarget))return;if(Ye(t))return;if("Escape"===e.key)return void bt(t);const n=e.target.closest(".sf-list-item");n&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Lt(t,n)))}function Dt(e){const t=e.currentTarget.__sfDropdownRoot||e.currentTarget.closest(Ie);t&&!Ye(t)&&yt(t,e.currentTarget.value)}function At(e){if(function(e,t){if(e?.classList)for(const[n,o]of Object.entries($e)){const o=`${t}--size-${n}`;e.classList.contains(o)&&e.classList.replace(o,`${t}--size-${Ne(n,t)}`)}}(e,"sf-dropdown"),je(e))return;if(!e||"1"===e.dataset[Ve])return;const t=Ge(e),n=Qe(e),s=Je(e);if(!t||!n)return;e.dataset[Ve]="1",e.removeAttribute("aria-expanded"),s&&!Be(e)&&(s.readOnly=!0),n.hidden=!e.classList.contains("sf-dropdown--open"),ht(e,e.classList.contains("sf-dropdown--open")),gt(e,4),xt(e),dt(e),e.__sfDropdownStateObserver=new MutationObserver(t=>{const n=xt(e);dt(e),n&&ft(e),t.some(e=>["portal","data-portal"].includes(e.attributeName))&&(e.classList.contains("sf-dropdown--open")&&Xe(e)?it(e):st(e),e.__sfDropdownInteraction?.refresh())}),e.__sfDropdownStateObserver.observe(e,{attributes:!0,attributeFilter:["class","disabled","portal","data-portal"]});const a=tt(e);a&&!e.__sfDropdownItemsObserver&&(e.__sfDropdownItemsObserver=new MutationObserver(()=>{xt(e),dt(e)}),e.__sfDropdownItemsObserver.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","hidden","aria-hidden"]}));const l=vt(e);if(l.length>0)ct(e,l),mt(e);else{const t=e.getAttribute("value")||e.dataset.selectedValue||"";if(t){const n=Ke(e)?t.split(",").map(e=>e.trim()).filter(Boolean):[t],o=nt(e).filter(e=>n.includes(at(e))),r=o[0];r&&(ct(e,Ke(e)?o:[r]),mt(e))}}!l.length&&Be(e)&&(ft(e),ut(e)),e.__sfDropdownOnClick=St,e.__sfDropdownOnKeydown=Et,e.addEventListener("click",St),e.addEventListener("keydown",Et);const c=Ze(e);c&&(e.__sfDropdownSearchInput=c,e.__sfDropdownOnSearchInput=Dt,c.__sfDropdownRoot=e,c.addEventListener("input",Dt)),e.__sfDropdownInteraction=o(e,{getList:()=>Qe(e),isOpen:()=>e.classList.contains("sf-dropdown--open"),isDisabled:()=>Ye(e),isMultiple:()=>Ke(e),selectedLabels:()=>vt(e).map(lt),open:()=>wt(e),close:()=>bt(e),select:t=>Lt(e,t)}),Object.prototype.hasOwnProperty.call(e,"__sfDropdownResetValues")||(e.__sfDropdownResetValues=vt(e).map(at));const d=et(e)||t.querySelector(":scope > button")||s;d&&(e.__sfDropdownReleaseReset=function(e,t){const n=e.ownerDocument;i.has(n)||(n.addEventListener("reset",e=>{const t=e.target;if("FORM"!==t?.tagName)return;const n=Array.from(t.elements);setTimeout(()=>{if(!e.defaultPrevented)for(const e of n)if(e.isConnected&&e.form===t)for(const t of r.get(e)||[])t()},0)},!0),i.add(n));let o=r.get(e);return o||r.set(e,o=new Set),o.add(t),()=>o.delete(t)}(d,()=>{const t=nt(e).filter(t=>e.__sfDropdownResetValues.includes(at(t))),n=Ke(e)?t:t.slice(0,1);ct(e,n),mt(e),bt(e)}))}function kt(e){if(!e||"1"!==e.dataset[Ve])return;e.__sfDropdownInteraction?.release(),delete e.__sfDropdownInteraction,e.__sfDropdownReleaseReset?.(),delete e.__sfDropdownReleaseReset,st(e),e.__sfDropdownItemsObserver?.disconnect?.(),e.__sfDropdownStateObserver?.disconnect?.(),e.removeEventListener("click",e.__sfDropdownOnClick),e.removeEventListener("keydown",e.__sfDropdownOnKeydown);const t=Qe(e);t&&e.__sfDropdownPortalClick&&(t.removeEventListener("click",e.__sfDropdownPortalClick),t.removeEventListener("keydown",e.__sfDropdownPortalKeydown)),e.__sfDropdownSearchInput&&e.__sfDropdownOnSearchInput&&(e.__sfDropdownSearchInput.removeEventListener("input",e.__sfDropdownOnSearchInput),delete e.__sfDropdownSearchInput.__sfDropdownRoot),delete e.__sfDropdownOnClick,delete e.__sfDropdownOnKeydown,delete e.__sfDropdownPortalClick,delete e.__sfDropdownPortalKeydown,delete e.__sfDropdownSearchInput,delete e.__sfDropdownOnSearchInput,delete e.__sfDropdownItemsObserver,delete e.__sfDropdownStateObserver,delete e.__sfDropdownDisabledState,delete e.dataset[Ve]}function Ct(e=document){e.querySelectorAll(Ie).forEach(At)}document.__sfDropdownDocumentClickBound||(document.addEventListener("click",function(e){document.querySelectorAll(`${Ie}.sf-dropdown--open`).forEach(t=>{ot(t,e.target)||bt(t)})}),document.__sfDropdownDocumentClickBound=!0),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>Ct()):Ct();new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e instanceof Element&&(e.matches?.(Ie)&&At(e),Ct(e))}),e.removedNodes.forEach(e=>{e instanceof Element&&!e.isConnected&&(e.matches?.(Ie)&&kt(e),e.querySelectorAll?.(Ie).forEach(kt))})})}).observe(document.documentElement,{childList:!0,subtree:!0})})();
1
+ (()=>{"use strict";let e=0;function t(e,t){const n=e.querySelector('.sf-checkbox input[type="checkbox"]');if(!n)return;const o=e.querySelector(".sf-checkbox-box sf-icon, .sf-checkbox-box .sf-icon"),r="sf-icon"===o?.tagName?.toLowerCase()?o.getAttribute("icon")||"":o?.textContent;(n.checked!==t||n.indeterminate||o&&r!==(t?"check":""))&&(n.checked=t,n.indeterminate=!1,globalThis.SF?.Checkbox?.setState?.(n,{checked:t,indeterminate:!1}))}function n(t,n){if(!t.id){let o;do{o=`${n}-${++e}`}while(document.getElementById(o));t.id=o}return t.id}function o(e,o){let r=null,i=null,s=null,a=!1;const l=new WeakMap,c=(e,t,n)=>{const o=l.get(e)||{};void 0!==o[t]&&e.getAttribute(t)===o[t]&&e.removeAttribute(t),delete o[t],!e.hasAttribute(t)&&n&&(e.setAttribute(t,n),o[t]=n),l.set(e,o)},d=()=>e.querySelector(".sf-dropdown-field, .sf-dropdown-trigger"),f=()=>d()?.querySelector(":scope > button")||d(),u=()=>d()?.querySelector('input:not([type="hidden"])'),p=()=>o.getList()?.querySelector(".sf-input input"),m=()=>[...o.getList()?.querySelectorAll(".sf-list-item")||[]],h=()=>m().filter(e=>!e.hidden&&!e.classList.contains("disabled")&&"true"!==e.getAttribute("aria-disabled")&&"true"!==e.getAttribute("aria-hidden")),g=e=>e.querySelector(".sf-list-item-container, .sf-avatar-label-group-title, .sf-tag-container")?.textContent?.trim()||e.dataset.value||"",w=e=>{e&&!e.disabled&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",inline:"nearest"}))},b=()=>{i="trigger",w(f()),o.close(),_()},y=e=>{if(o.isDisabled()||e.altKey||e.ctrlKey||e.metaKey)return;const t=e.target,n=t.closest?.(".sf-list-item"),r=o.getList()?.contains(t),s=t===f()||t===u()||t===d();let a=!1;if("Escape"===e.key&&o.isOpen())b(),a=!0;else{if("Tab"===e.key&&o.isOpen())return r&&w(f()),o.close(),void _();if(s&&["ArrowDown","ArrowUp","Enter"," "].includes(e.key))o.isOpen()&&["Enter"," "].includes(e.key)?b():(e=>{i=e,o.open(),_()})("ArrowUp"===e.key?"last":"search"),a=!0;else if(r&&["ArrowDown","ArrowUp"].includes(e.key)){const t=h(),o=t.indexOf(n),r=o<0?"ArrowUp"===e.key?t.length-1:0:Math.max(0,Math.min(t.length-1,o+("ArrowUp"===e.key?-1:1)));w(t[r]),a=!0}else if(n&&r&&["Home","End"].includes(e.key)){const t=h();w("Home"===e.key?t[0]:t.at(-1)),a=!0}else n&&r&&["Enter"," "].includes(e.key)&&(h().includes(n)&&(i=o.isMultiple()?{value:n.dataset.value}:"trigger",o.select(n),_()),a=!0)}a&&(e.preventDefault(),e.stopImmediatePropagation())},v=()=>{null!==s&&cancelAnimationFrame(s),s=requestAnimationFrame(()=>{var t;s=null,a||!o.isOpen()||i||(t=document.activeElement)&&(e.contains(t)||o.getList()?.contains(t))||(o.close(),_())})};let x=document.createElement("span");x.className="sf-dropdown-value",e.append(x),n(x,"sf-dropdown-value");const _=()=>{if(a)return;const s=o.getList();r!==s&&(r?.removeEventListener("keydown",y,!0),r?.removeEventListener("focusout",v),r=s,r?.addEventListener("keydown",y,!0),r?.addEventListener("focusout",v));const b=f(),_=r?.querySelector(".sf-list-container");if(!b||!_)return;x.isConnected||e.append(x);const L=e.querySelector(".sf-dropdown-label .sf-dropdown-text"),S=o.owner||e,E=L?.textContent.trim()?n(L,"sf-dropdown-label"):"",D=S.getAttribute("aria-label")||e.getAttribute("aria-label"),A=S.getAttribute("aria-labelledby")||e.getAttribute("aria-labelledby"),k=n(b,"sf-dropdown-trigger"),C=b.hasAttribute("aria-label")&&l.get(b)?.["aria-label"]!==b.getAttribute("aria-label");c(b,"aria-labelledby",A||(!D&&E?C?`${k} ${E}`:E:"")),c(b,"aria-label",D),"BUTTON"!==b.tagName&&b.setAttribute("role","button"),b.tabIndex=o.isDisabled()?-1:0,b.setAttribute("aria-expanded",String(o.isOpen())),b.setAttribute("aria-haspopup","listbox"),b.setAttribute("aria-controls",n(_,"sf-dropdown-listbox")),b.querySelectorAll(".sf-icon").forEach(e=>e.setAttribute("aria-hidden","true")),d()!==b&&(d().tabIndex=-1),u()&&(u().tabIndex=-1),_.setAttribute("role","listbox"),_.setAttribute("aria-multiselectable",String(o.isMultiple())),c(_,"aria-labelledby",A||E||k);const O=p();O&&(O.setAttribute("role","searchbox"),O.setAttribute("aria-controls",_.id),c(O,"aria-labelledby",O.hasAttribute("aria-label")?"":A||E||k)),m().forEach(e=>{e.setAttribute("role","option"),e.tabIndex=-1,e.setAttribute("aria-selected",String(e.classList.contains("selected"))),c(e,"aria-disabled",e.classList.contains("disabled")?"true":""),t(e,e.classList.contains("selected")),e.querySelectorAll(".sf-checkbox").forEach(e=>{"true"!==e.getAttribute("aria-hidden")&&e.setAttribute("aria-hidden","true")}),e.querySelectorAll(".sf-icon, sf-icon").forEach(e=>{"true"!==e.getAttribute("aria-hidden")&&e.setAttribute("aria-hidden","true")}),e.querySelectorAll("input, button, a[href], [tabindex]").forEach(e=>{e.tabIndex=-1})});const P=o.selectedLabels?.()||m().filter(e=>e.classList.contains("selected")).map(g);x.textContent=P.join(", ")||u()?.value||u()?.placeholder||"";const T=new Set((b.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean));T.add(x.id),b.setAttribute("aria-describedby",[...T].join(" ")),(()=>{if(!i)return;if("trigger"===i)return i=null,void w(f());if(!o.isOpen()||o.getList()?.hidden)return;const e=h(),t="search"===i?p()||e[0]||f():"last"===i?e.at(-1):"object"==typeof i?e.find(e=>e.dataset.value===i.value):e[0];i=null,w(t)})()};return e.addEventListener("keydown",y,!0),e.addEventListener("focusout",v),_(),{refresh:_,beforeClose:()=>{o.getList()?.contains(document.activeElement)&&(i="trigger")},release(){a=!0,null!==s&&cancelAnimationFrame(s),e.removeEventListener("keydown",y,!0),e.removeEventListener("focusout",v),r?.removeEventListener("keydown",y,!0),r?.removeEventListener("focusout",v);const t=f();if(t){const e=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(e=>e&&e!==x.id);e.length?t.setAttribute("aria-describedby",e.join(" ")):t.removeAttribute("aria-describedby")}x.remove()}}}const r=new WeakMap,i=new WeakSet;const s=Math.min,a=Math.max,l=Math.round,c=Math.floor,d=e=>({x:e,y:e}),f={left:"right",right:"left",bottom:"top",top:"bottom"};function u(e,t){return"function"==typeof e?e(t):e}function p(e){return e.split("-")[0]}function m(e){return e.split("-")[1]}function h(e){return"x"===e?"y":"x"}function g(e){return"y"===e?"height":"width"}function w(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function b(e){return h(w(e))}function y(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const v=["left","right"],x=["right","left"],_=["top","bottom"],L=["bottom","top"];function S(e,t,n,o){const r=m(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?x:v:t?v:x;case"left":case"right":return t?_:L;default:return[]}}(p(e),"start"===n,o);return r&&(i=i.map(e=>e+"-"+r),t&&(i=i.concat(i.map(y)))),i}function E(e){const t=p(e);return f[t]+e.slice(t.length)}function D(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function A(e,t,n){let{reference:o,floating:r}=e;const i=w(t),s=b(t),a=g(s),l=p(t),c="y"===i,d=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,u=o[a]/2-r[a]/2;let h;switch(l){case"top":h={x:d,y:o.y-r.height};break;case"bottom":h={x:d,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:f};break;case"left":h={x:o.x-r.width,y:f};break;default:h={x:o.x,y:o.y}}const y=m(t);return y&&(h[s]+=u*("end"===y?1:-1)*(n&&c?-1:1)),h}async function k(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:m=0}=u(t,e),h=function(e){return"number"!=typeof e?function(e){var t,n,o,r;return{top:null!=(t=e.top)?t:0,right:null!=(n=e.right)?n:0,bottom:null!=(o=e.bottom)?o:0,left:null!=(r=e.left)?r:0}}(e):{top:e,right:e,bottom:e,left:e}}(m),g=a[p?"floating"===f?"reference":"floating":f],w=D(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),b="floating"===f?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),v=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=D(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:y,strategy:l}):b);return{top:(w.top-x.top+h.top)/v.y,bottom:(x.bottom-w.bottom+h.bottom)/v.y,left:(w.left-x.left+h.left)/v.x,right:(x.right-w.right+h.right)/v.x}}const C=new Set(["left","top"]);function O(){return"undefined"!=typeof window}function P(e){return q(e)?(e.nodeName||"").toLowerCase():"#document"}function T(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function R(e){var t;return null==(t=(q(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function q(e){return!!O()&&(e instanceof Node||e instanceof T(e).Node)}function F(e){return!!O()&&(e instanceof Element||e instanceof T(e).Element)}function I(e){return!!O()&&(e instanceof HTMLElement||e instanceof T(e).HTMLElement)}function M(e){return!(!O()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof T(e).ShadowRoot)}function z(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&"inline"!==r&&"contents"!==r}function $(e){return/^(table|td|th)$/.test(P(e))}function N(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}const V=/transform|translate|scale|rotate|perspective|filter/,W=/paint|layout|strict|content/,H=e=>!!e&&"none"!==e;let B;function j(e){const t=F(e)?Y(e):e;return H(t.transform)||H(t.translate)||H(t.scale)||H(t.rotate)||H(t.perspective)||!U()&&(H(t.backdropFilter)||H(t.filter))||V.test(t.willChange||"")||W.test(t.contain||"")}function U(){return null==B&&(B="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),B}function K(e){return/^(html|body|#document)$/.test(P(e))}function Y(e){return T(e).getComputedStyle(e)}function X(e){return F(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function G(e){if("html"===P(e))return e;const t=e.assignedSlot||e.parentNode||M(e)&&e.host||R(e);return M(t)?t.host:t}function J(e){const t=G(e);return K(t)?(e.ownerDocument||e).body:I(t)&&z(t)?t:J(t)}function Q(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=J(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),s=T(r);if(i){const e=Z(s);return t.concat(s,s.visualViewport||[],z(r)?r:[],e&&n?Q(e):[])}return t.concat(r,Q(r,[],n))}function Z(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ee(e){const t=Y(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=I(e),i=r?e.offsetWidth:n,s=r?e.offsetHeight:o,a=l(n)!==i||l(o)!==s;return a&&(n=i,o=s),{width:n,height:o,$:a}}function te(e){return F(e)?e:e.contextElement}function ne(e){const t=te(e);if(!I(t))return d(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=ee(t);let s=(i?l(n.width):n.width)/o,a=(i?l(n.height):n.height)/r;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const oe=d(0);function re(e){const t=T(e);return U()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:oe}function ie(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=te(e);let s=d(1);t&&(o?F(o)&&(s=ne(o)):s=ne(e));const a=function(e,t,n){return void 0===t&&(t=!1),!!n&&t&&n===T(e)}(i,n,o)?re(i):d(0);let l=(r.left+a.x)/s.x,c=(r.top+a.y)/s.y,f=r.width/s.x,u=r.height/s.y;if(i&&o){const e=T(i),t=F(o)?T(o):o;let n=e,r=Z(n);for(;r&&t!==n;){const e=ne(r),t=r.getBoundingClientRect(),o=Y(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,s=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;l*=e.x,c*=e.y,f*=e.x,u*=e.y,l+=i,c+=s,n=T(r),r=Z(n)}}return D({width:f,height:u,x:l,y:c})}function se(e,t){const n=X(e).scrollLeft;return t?t.left+n:ie(R(e)).left+n}function ae(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-se(e,n),y:n.top+t.scrollTop}}function le(e,t,n){let o;if("viewport"===t||"layoutViewport"===t)o=function(e,t,n){void 0===n&&(n="viewport");const o="layoutViewport"===n,r=T(e),i=R(e),s=r.visualViewport;let a=i.clientWidth,l=i.clientHeight,c=0,d=0;if(s){const e=!U()||"fixed"===t;o?e||(c=-s.offsetLeft,d=-s.offsetTop):(a=s.width,l=s.height,e&&(c=s.offsetLeft,d=s.offsetTop))}if(se(i)<=0){const e=i.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,r=Math.abs(i.clientWidth-t.clientWidth-o),s="stable both-edges"===getComputedStyle(i).scrollbarGutter?r/2:r;s<=25&&(a-=s)}return{width:a,height:l,x:c,y:d}}(e,n,t);else if("document"===t)o=function(e){const t=X(e),n=e.ownerDocument.body,o=a(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=a(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+se(e);const s=-t.scrollTop;return"rtl"===Y(n).direction&&(i+=a(e.clientWidth,n.clientWidth)-o),{width:o,height:r,x:i,y:s}}(R(e));else if(F(t))o=function(e,t){const n=ie(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=ne(e);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:o*i.y}}(t,n);else{const n=re(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return D(o)}function ce(e,t,n){const o=I(t),r=R(t),i="fixed"===n,s=ie(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=d(0);if((o||!i)&&(("body"!==P(t)||z(r))&&(a=X(t)),o)){const e=ie(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!o&&r&&(l.x=se(r));const c=!r||o||i?d(0):ae(r,a);return{x:s.left+a.scrollLeft-l.x-c.x,y:s.top+a.scrollTop-l.y-c.y,width:s.width,height:s.height}}function de(e){return"static"===Y(e).position}function fe(e,t){if(!I(e)||"fixed"===Y(e).position)return null;if(t)return t(e);let n=e.offsetParent;return R(e)===n&&(n=n.ownerDocument.body),n}function ue(e,t){const n=T(e);if(N(e))return n;if(!I(e)){let t=G(e);for(;t&&!K(t);){if(F(t)&&!de(t))return t;t=G(t)}return n}let o=fe(e,t);for(;o&&$(o)&&de(o);)o=fe(o,t);return o&&K(o)&&de(o)&&!j(o)?n:o||function(e){let t=G(e);for(;I(t)&&!K(t);){if(j(t))return t;if(N(t))return null;t=G(t)}return null}(e)||n}const pe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,s=R(o),a=!!t&&N(t.floating);if(o===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=d(1);const f=d(0),u=I(o);if((u||!i)&&(("body"!==P(o)||z(s))&&(l=X(o)),u)){const e=ie(o);c=ne(o),f.x=e.x+o.clientLeft,f.y=e.y+o.clientTop}const p=!s||u||i?d(0):ae(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+p.x,y:n.y*c.y-l.scrollTop*c.y+f.y+p.y}},getDocumentElement:R,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[..."clippingAncestors"===n?N(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=Q(e,[],!1).filter(e=>F(e)&&"body"!==P(e)),r=null;const i="fixed"===Y(e).position;let s=i?G(e):e;for(;F(s)&&!K(s);){const e=Y(s),t=j(s),n=r?r.position:i?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?r=e:o=o.filter(e=>e!==s),s=G(s)}return t.set(e,o),o}(t,this._c):[].concat(n),o],l=le(t,i[0],r);let c=l.top,d=l.right,f=l.bottom,u=l.left;for(let e=1;e<i.length;e++){const n=le(t,i[e],r);c=a(n.top,c),d=s(n.right,d),f=s(n.bottom,f),u=a(n.left,u)}return{width:d-u,height:f-c,x:u,y:c}},getOffsetParent:ue,getElementRects:async function(e){const t=this.getOffsetParent||ue,n=this.getDimensions,o=await n(e.floating);return{reference:ce(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){const{width:t,height:n}=ee(e);return{width:t,height:n}},getScale:ne,isElement:F,isRTL:function(e){return"rtl"===Y(e).direction}};function me(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function he(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:d="function"==typeof IntersectionObserver,animationFrame:f=!1}=o,u=te(e),p=r||i?[...u?Q(u):[],...t?Q(t):[]]:[];p.forEach(e=>{r&&e.addEventListener("scroll",n),i&&e.addEventListener("resize",n)});const m=u&&d?function(e,t,n){let o,r=null;const i=R(e);function l(){var e;clearTimeout(o),null==(e=r)||e.disconnect(),r=null}function d(n,f){void 0===n&&(n=!1),void 0===f&&(f=1),l();const u=e.getBoundingClientRect(),{left:p,top:m,width:h,height:g}=u;if(n||t(),!h||!g)return;const w={rootMargin:-c(m)+"px "+-c(i.clientWidth-(p+h))+"px "+-c(i.clientHeight-(m+g))+"px "+-c(p)+"px",threshold:a(0,s(1,f))||1};let b=!0;function y(t){const n=t[0].intersectionRatio;if(!me(u,e.getBoundingClientRect()))return d();if(n!==f){if(!b)return d();n?d(!1,n):o=setTimeout(()=>{d(!1,1e-7)},1e3)}b=!1}try{r=new IntersectionObserver(y,{...w,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(y,w)}r.observe(e)}const f=T(e),u=()=>d(n);return f.addEventListener("resize",u),d(!0),()=>{f.removeEventListener("resize",u),l()}}(u,n,i):null;let h,g=-1,w=null;l&&(w=new ResizeObserver(e=>{let[o]=e;o&&o.target===u&&w&&t&&(w.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var e;null==(e=w)||e.observe(t)})),n()}),u&&!f&&w.observe(u),t&&w.observe(t));let b=f?ie(e):null;return f&&function t(){const o=ie(e);b&&!me(b,o)&&n();b=o,h=requestAnimationFrame(t)}(),n(),()=>{var e;p.forEach(e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==m||m(),null==(e=w)||e.disconnect(),w=null,f&&cancelAnimationFrame(h)}}const ge=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:s,middlewareData:a}=t,l=await async function(e,t){const{placement:n,platform:o,elements:r}=e,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),s=p(n),a=m(n),l="y"===w(n),c=C.has(s)?-1:1,d=i&&l?-1:1,f=u(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:b}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&"number"==typeof b&&(g="end"===a?-1*b:b),l?{x:g*d,y:h*c}:{x:h*c,y:g*d}}(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(o=a.arrow)&&o.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:s}}}}},we=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:i}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:d={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...f}=u(e,t),p={x:n,y:o},m=await i.detectOverflow(t,f),g=w(r),b=h(g);let y=p[b],v=p[g];const x=(e,t)=>{return n=t+m["y"===e?"top":"left"],o=t,r=t-m["y"===e?"bottom":"right"],a(n,s(o,r));var n,o,r};l&&(y=x(b,y)),c&&(v=x(g,v));const _=d.fn({...t,[b]:y,[g]:v});return{..._,data:{x:_.x-n,y:_.y-o,enabled:{[b]:l,[g]:c}}}}}},be=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:_=!0,...L}=u(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const D=p(r),A=w(a),k=p(a)===a,C=await(null==l.isRTL?void 0:l.isRTL(c.floating)),O=h||(k||!_?[E(a)]:function(e){const t=E(e);return[y(e),t,y(t)]}(a)),P="none"!==x;!h&&P&&O.push(...S(a,_,x,C));const T=[a,...O],R=await l.detectOverflow(t,L),q=[];let F=(null==(o=i.flip)?void 0:o.overflows)||[];if(d&&q.push(R[D]),f){const e=function(e,t,n){void 0===n&&(n=!1);const o=m(e),r=b(e),i=g(r);let s="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=E(s)),[s,E(s)]}(r,s,C);q.push(R[e[0]],R[e[1]])}if(F=[...F,{placement:r,overflows:q}],!q.every(e=>e<=0)){var I,M;const e=((null==(I=i.flip)?void 0:I.index)||0)+1,t=T[e];if(t){if(!("alignment"===f&&A!==w(t))||F.every(e=>w(e.placement)!==A||e.overflows[0]>0))return{data:{index:e,overflows:F},reset:{placement:t}}}let n=null==(M=F.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:M.placement;if(!n)switch(v){case"bestFit":{var z;const e=null==(z=F.filter(e=>{if(P){const t=w(e.placement);return t===A||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:z[0];e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}},ye=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:r,elements:i}=t,{apply:l=()=>{},...c}=u(e,t),d=await r.detectOverflow(t,c),f=p(n),h=m(n),g="y"===w(n),{width:b,height:y}=o.floating;let v,x;"top"===f||"bottom"===f?(v=f,x=h===(await(null==r.isRTL?void 0:r.isRTL(i.floating))?"start":"end")?"left":"right"):(x=f,v="end"===h?"top":"bottom");const _=y-d.top-d.bottom,L=b-d.left-d.right,S=s(y-d[v],_),E=s(b-d[x],L),D=t.middlewareData.shift,A=!D;let k=S,C=E;null!=D&&D.enabled.x&&(C=L),null!=D&&D.enabled.y&&(k=_),A&&!h&&(g?C=b-2*a(d.left,d.right):k=y-2*a(d.top,d.bottom)),await l({...t,availableWidth:C,availableHeight:k});const O=await r.getDimensions(i.floating);return b!==O.width||y!==O.height?{reset:{rects:!0}}:{}}}},ve=(e,t,n)=>{const o=new Map,r=null!=n?n:{},i={...pe,...r.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:k},l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:f}=A(c,o,l),u=o,p=0;const m={};for(let n=0;n<i.length;n++){const h=i[n];if(!h)continue;const{name:g,fn:w}=h,{x:b,y,data:v,reset:x}=await w({x:d,y:f,initialPlacement:o,placement:u,strategy:r,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=b?b:d,f=null!=y?y:f,m[g]={...m[g],...v},x&&p<50&&(p++,"object"==typeof x&&(x.placement&&(u=x.placement),x.rects&&(c=!0===x.rects?await s.getElementRects({reference:e,floating:t,strategy:r}):x.rects),({x:d,y:f}=A(c,u,l))),n=-1)}return{x:d,y:f,placement:u,strategy:r,middlewareData:m}})(e,t,{...r,platform:i})},xe=["block-start","block-end","inline-start","inline-end"],_e=["start","center","end"];function Le(e="block-end",t="start",n=!1){if(!xe.includes(e))throw new TypeError(`Unknown placement side: ${e}`);if(!_e.includes(t))throw new TypeError(`Unknown placement alignment: ${t}`);const o="block-start"===e?"top":"block-end"===e?"bottom":"inline-start"===e?n?"right":"left":n?"left":"right";return"center"===t?o:`${o}-${t}`}function Se(e,t=!1){const n=String(e).split("-")[0];return"top"===n?"block-start":"bottom"===n?"block-end":"left"===n?t?"inline-end":"inline-start":t?"inline-start":"inline-end"}function Ee(e,t=document.body){if("number"==typeof e)return Number.isFinite(e)?e:0;if("string"!=typeof e||""===e.trim())return 0;const n=document.createElement("span");n.style.cssText="position:absolute;visibility:hidden;pointer-events:none;block-size:0;padding:0;border:0",n.style.inlineSize=e,(t?.isConnected?t:document.body).append(n);const o=parseFloat(getComputedStyle(n).width)||0;return n.remove(),o}const De=Object.freeze({anchor:function(e,t,n={}){if(!(e instanceof Element&&t instanceof HTMLElement))throw new TypeError("Anchored positioning needs a reference element and a floating element");const o={side:"block-end",align:"start",offset:"var(--sf-space-1\\/4)",alignmentOffset:0,padding:"var(--sf-space-1\\/2)",flip:!0,shift:!0,matchWidth:!1,fitHeight:!0,autoUpdate:!0,onPosition:null,...n},r=["position","left","top","right","bottom","margin","max-height","max-width",...o.matchWidth?["width"]:[]].map(e=>[e,t.style.getPropertyValue(e),t.style.getPropertyPriority(e)]),i={maxHeight:t.style.getPropertyValue("max-height")},s=getComputedStyle(t),a=(e,t)=>{const n=parseFloat(e);return Number.isFinite(n)?String(e).trim().endsWith("%")?n/100*t:n:1/0},l=a(s.maxHeight,document.documentElement.clientHeight),c=a(s.maxWidth,document.documentElement.clientWidth),d={side:o.side,stopped:!1};let f=null,u=!1;const p=async()=>{const n="rtl"===getComputedStyle(e).direction;const r=Ee(o.offset,e.parentElement),s=Ee(o.padding,e.parentElement);o.fitHeight&&(t.style.maxHeight=i.maxHeight||"");const a=e.getBoundingClientRect(),f=document.documentElement.clientWidth,u={top:s,bottom:s,left:Math.min(s,Math.max(0,a.left)),right:Math.min(s,Math.max(0,f-a.right))},p=[ge({mainAxis:r,alignmentAxis:Ee(o.alignmentOffset,e.parentElement)})];o.flip&&p.push(be({padding:s,crossAxis:!1})),o.shift&&p.push(we({padding:u,crossAxis:!1})),p.push(ye({padding:u,apply({availableWidth:e,availableHeight:t,rects:n,elements:r}){if(d.stopped)return;const i=f-u.left-u.right;o.matchWidth&&(r.floating.style.width=`${Math.max(0,Math.min(n.reference.width,i))}px`),r.floating.style.maxWidth=`${Math.max(0,Math.min(e,i,c))}px`,o.fitHeight&&(r.floating.style.maxHeight=`${Math.max(0,Math.min(t,l))}px`)}}));const m=await ve(e,t,{strategy:"fixed",placement:Le(o.side,o.align,n),middleware:p});return d.stopped||(Object.assign(t.style,{position:"fixed",left:`${m.x}px`,top:`${m.y}px`,right:"auto",bottom:"auto",margin:"0"}),d.side=Se(m.placement,n),t.dataset.sfSide=d.side,o.onPosition?.({side:d.side,placement:m.placement,x:m.x,y:m.y})),m};d.update=()=>d.stopped?Promise.resolve(null):f?(u=!0,f):(f=p().finally(()=>{f=null,u&&!d.stopped&&(u=!1,d.update())}),f);const m=o.autoUpdate?he(e,t,d.update):null;return d.stop=()=>{d.stopped=!0,m?.(),delete t.dataset.sfSide;for(const[e,n,o]of r)n?t.style.setProperty(e,n,o):t.style.removeProperty(e)},o.autoUpdate||d.update(),d},logicalSide:Se,physicalPlacement:Le,resolveLength:Ee});"undefined"!=typeof globalThis&&(globalThis.SF=globalThis.SF||{},globalThis.SF.Position||(globalThis.SF.Position=De));const Ae=De,ke=new WeakMap,Ce=["position","inset","margin","width","max-width","max-height","overflow","left","top","right","bottom","z-index"],Oe=["font-family","font-size","font-weight","font-style","font-stretch","font-variant","font-feature-settings","font-variation-settings","font-optical-sizing","font-kerning","line-height","letter-spacing","word-spacing","text-transform","text-indent","white-space","word-break","overflow-wrap","text-rendering","direction","writing-mode","text-orientation","color","color-scheme","text-align"];function Pe(e,t){if(!t.context)return;const n=t.context,o=getComputedStyle(e),r=["sf-dropdown",...Array.from(e.classList).filter(e=>e.startsWith("sf-dropdown--")&&!["sf-dropdown--open","sf-dropdown--drop-up","sf-dropdown--drop-down"].includes(e))].join(" ");n.className!==r&&(n.className=r);const i=[...Array.from(o).filter(e=>e.startsWith("--sf-")),...Oe],s=new Set(i);for(const e of t.contextProperties||[])s.has(e)||n.style.removeProperty(e);for(const e of i){const t=o.getPropertyValue(e);n.style.getPropertyValue(e)!==t&&n.style.setProperty(e,t)}t.contextProperties=i}function Te(e){return e?.querySelector(".sf-dropdown-field, .sf-dropdown-trigger")??null}function Re(e,t){const n=ke.get(t);if(!n||!e.isConnected||t.hidden)return!1;const o=Te(e);return!!o&&(e.closest('[hidden], [inert], [aria-hidden="true"], dialog:not([open])')||!o.getClientRects().length||["hidden","collapse"].includes(getComputedStyle(o).visibility)?(n.onUnavailable?.(),!1):(Pe(e,n),n.wrap&&(n.wrap.style.minHeight="0",n.wrap.style.overflowY="auto"),n.anchor||(n.anchor=(globalThis.SF?.Position||Ae).anchor(o,t,{side:"block-end",align:"start",matchWidth:o.classList.contains("sf-dropdown-field"),fitHeight:!0,autoUpdate:!1,onPosition:({side:n})=>{const o="block-start"===n;t.dataset.placement=e.dataset.placement=o?"top":"bottom",e.classList.toggle("sf-dropdown--drop-up",o),e.classList.toggle("sf-dropdown--drop-down",!o)}})),n.anchor.update(),!0))}function qe(){const e=globalThis.SF=globalThis.SF||{};return e.__deprecationNotes instanceof Map||Object.defineProperty(e,"__deprecationNotes",{value:new Map,configurable:!0}),e.__deprecationNotes}function Fe({component:e="",kind:t="attribute",attribute:n="",from:o,to:r=null}={}){if(!o)return;const i=[e,t,n,o].join("|"),s=qe(),a=s.get(i);if(a)a.count+=1;else if(s.set(i,{component:e,kind:t,attribute:n,from:o,to:r,count:1}),function(){const e=globalThis.document?.documentElement;return"warn"===e?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const i=e?`${e}: `:"",s="value"===t?`${n}="${o}"`:`${t} ${o}`;globalThis.console?.warn?.(`[SIMAI Framework] ${i}${s} is a legacy name${r?`; write ${r}`:""}. See contracts/changes/journal.json.`)}}if("undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const e=globalThis.SF.deprecations||{};e.list=function(){return[...qe().values()].map(e=>({...e}))},e.clear=function(){qe().clear()},e.note=Fe,globalThis.SF.deprecations=e}const Ie=Object.freeze(["1/2","1","2"]),Me=Object.freeze({"1/3":"1/2",3:"2"}),ze=new Set;function $e(e,t="field",n="1"){const o=String(e??"").trim().toLowerCase();if(Ie.includes(o))return o;if(Object.hasOwn(Me,o)){const e=Me[o];Fe({component:t,kind:"value",attribute:"size",from:o,to:e});const n=`${t}:${o}`;return ze.has(n)||"undefined"==typeof console||(ze.add(n),console.warn(`[SIMAI Framework] ${t}: size ${o} is retired for form fields; rendering size ${e}.`)),e}return n}const Ne=".sf-dropdown",Ve="sfDropdownBound",We=".sf-list-item-selected-item",He=Object.freeze({"1/2":{size:"1/3",spacing:""},1:{size:"1",spacing:"compact"},2:{size:"2",spacing:"compact"}});function Be(e){return e.classList.contains("sf-dropdown--tag")}function je(e){const t=e?.closest?.("sf-dropdown");return Boolean(t?.__sfSmartElement)}function Ue(e,t=!1){return null==e||""===e?t:"boolean"==typeof e?e:["1","true","yes","on"].includes(String(e).toLowerCase())}function Ke(e){return!!e&&(e.hasAttribute("multiple")?Ue(e.getAttribute("multiple"),!0):void 0!==e.dataset.multiple?Ue(e.dataset.multiple,!1):Be(e))}function Ye(e){return!!e&&(!!e.classList.contains("disabled")||!!e.hasAttribute("disabled")&&Ue(e.getAttribute("disabled"),!0))}function Xe(e){return!!e&&(e.hasAttribute("portal")?Ue(e.getAttribute("portal"),!0):void 0===e.dataset.portal||Ue(e.dataset.portal,!0))}function Ge(e){return e.querySelector(".sf-dropdown-field")}function Je(e){return e.querySelector(".sf-dropdown-field input:not(.sf-dropdown-hidden-input)")}function Qe(e){return e.__sfDropdownPortalList||e.querySelector(".sf-list")}function Ze(e){return Qe(e)?.querySelector(".sf-input input")||null}function et(e){return e.querySelector(".sf-dropdown-hidden-input")}function tt(e){return Qe(e)?.querySelector(".sf-list-container")||null}function nt(e){return Array.from(Qe(e)?.querySelectorAll(".sf-list-item")||[])}function ot(e,t){return!(!e||!t)&&(!!e.contains(t)||Boolean(e.__sfDropdownPortalList?.contains(t)))}function rt(e){e&&Xe(e)&&Re(e,Qe(e))}function it(e){if(!e||!Xe(e))return;const t=Qe(e);t&&function(e,t,n){if(!t?.isConnected||!Te(e))return!1;const o=t.contains(document.activeElement)?document.activeElement:null;if(!ke.has(t)){const o=Ce.map(e=>[e,t.style.getPropertyValue(e),t.style.getPropertyPriority(e)]),r={root:e,saved:o,onUnavailable:n,popover:t.getAttribute("popover"),frame:0,native:"function"==typeof t.showPopover};r.wrap=t.querySelector(".sf-list-container-wrap"),r.wrapStyles=r.wrap?["min-height","overflow-y"].map(e=>[e,r.wrap.style.getPropertyValue(e),r.wrap.style.getPropertyPriority(e)]):[],r.schedule=()=>{r.frame||(r.frame=requestAnimationFrame(()=>{r.frame=0,Re(e,t)}))},ke.set(t,r),e.__sfDropdownPortalList=t,r.native?t.setAttribute("popover","manual"):(r.parent=t.parentNode,r.next=t.nextSibling,r.context=document.createElement("div"),r.context.style.cssText="display:contents;position:static",Pe(e,r),(e.closest('dialog[open], [role="dialog"][aria-modal="true"]')||document.body).append(r.context),r.context.append(t),t.style.zIndex="var(--sf-z-index-9)"),r.inheritance=new MutationObserver(r.schedule);for(let t=e;t;t=t.parentElement)r.inheritance.observe(t,{attributes:!0,attributeFilter:["class","style","dir","hidden","inert","aria-hidden","open"]});Object.assign(t.style,{position:"fixed",inset:"auto",margin:"0",overflow:r.wrap?"hidden":"auto"}),"function"==typeof ResizeObserver&&(r.resize=new ResizeObserver(r.schedule),r.resize.observe(Te(e)),r.resize.observe(t)),window.visualViewport?.addEventListener("resize",r.schedule),window.visualViewport?.addEventListener("scroll",r.schedule)}return t.hidden=!1,ke.get(t).native&&!t.matches(":popover-open")&&t.showPopover(),!!Re(e,t)&&(o&&document.activeElement!==o&&o.focus({preventScroll:!0}),!0)}(e,t,()=>bt(e))&&(t.__sfDropdownRoot=e,e.__sfDropdownPortalClick||(e.__sfDropdownPortalClick=St,e.__sfDropdownPortalKeydown=Et,t.addEventListener("click",St),t.addEventListener("keydown",Et)),e.__sfDropdownPortalOnViewportChange||(e.__sfDropdownPortalOnViewportChange=()=>{e.classList.contains("sf-dropdown--open")&&rt(e)}),window.addEventListener("resize",e.__sfDropdownPortalOnViewportChange),document.addEventListener("scroll",e.__sfDropdownPortalOnViewportChange,!0))}function st(e){if(!e)return;const t=Qe(e);!function(e){const t=ke.get(e);if(!t)return!1;const n=e.contains(document.activeElement)?document.activeElement:null;t.anchor?.stop(),t.resize?.disconnect(),cancelAnimationFrame(t.frame),t.inheritance?.disconnect(),window.visualViewport?.removeEventListener("resize",t.schedule),window.visualViewport?.removeEventListener("scroll",t.schedule),t.native?(e.matches(":popover-open")&&e.hidePopover(),null===t.popover?e.removeAttribute("popover"):e.setAttribute("popover",t.popover)):(t.next?.parentNode===t.parent?t.parent.insertBefore(e,t.next):t.parent.append(e),t.context.remove());for(const[n,o,r]of t.saved)o?e.style.setProperty(n,o,r):e.style.removeProperty(n);for(const[e,n,o]of t.wrapStyles)n?t.wrap.style.setProperty(e,n,o):t.wrap.style.removeProperty(e);delete e.dataset.placement,delete t.root.dataset.placement,t.root.classList.remove("sf-dropdown--drop-up","sf-dropdown--drop-down"),t.root.__sfDropdownPortalList===e&&delete t.root.__sfDropdownPortalList,ke.delete(e),n&&!e.hidden&&t.root.isConnected&&document.activeElement!==n&&n.focus({preventScroll:!0})}(t),t&&e.__sfDropdownPortalClick&&(t.removeEventListener("click",e.__sfDropdownPortalClick),t.removeEventListener("keydown",e.__sfDropdownPortalKeydown)),delete e.__sfDropdownPortalClick,delete e.__sfDropdownPortalKeydown,e.__sfDropdownPortalOnViewportChange&&(window.removeEventListener("resize",e.__sfDropdownPortalOnViewportChange),document.removeEventListener("scroll",e.__sfDropdownPortalOnViewportChange,!0)),t&&delete t.__sfDropdownRoot,delete e.__sfDropdownPortalOnViewportChange}function at(e){return e?.dataset?.value??lt(e)}function lt(e){if(!e)return"";const t=e.querySelector(".sf-list-item-container")?.textContent?.trim();if(t)return t;const n=e.querySelector(".sf-tag-container")?.textContent?.trim();if(n)return n;const o=e.querySelector(".sf-avatar-label-group-title")?.textContent?.trim();return o||(e.dataset?.value?.trim?.()||e.textContent?.trim()||"")}function ct(e,n=[]){const o=new Set(n);nt(e).forEach(e=>{const n=o.has(e);e.classList.toggle("selected",n),e.setAttribute("aria-selected",n?"true":"false");const r=e.querySelector(We);n?function(e){if(!e.classList.contains("sf-list-item--text")&&!e.classList.contains("sf-list-item--icon"))return;if(!e||e.querySelector(We))return;const t=document.createElement("div");t.className="sf-list-item-selected-item flex";const n=document.createElement("i");n.className="sf-icon",n.textContent="check",t.append(n),e.append(t)}(e):r&&r.remove(),t(e,n)}),e.__sfDropdownInteraction?.refresh()}function dt(e){nt(e).forEach(t=>{const n=t.querySelector(".sf-checkbox"),o=t.querySelector(".sf-checkbox input");n&&o&&(o.tabIndex=-1,o.dataset.dropdownManaged="1",o.style.pointerEvents="none",n.style.pointerEvents="none",Ye(e)||t.classList.contains("disabled")?o.disabled=!0:o.disabled=!1)})}function ft(e){if(!Be(e))return;const t=function(e){return e.querySelector(".sf-dropdown-tag-container")}(e);t&&(t.innerHTML="",nt(e).filter(e=>e.classList.contains("selected")).forEach(n=>{t.append(function(e,t){const n=at(t),o=lt(t),r=e.className.match(/sf-dropdown--size-([^\s]+)/)?.[1]||"1",i=He[r]||He[1],s=i.size,a=i.spacing?` spacing-${i.spacing}`:"",l=t.classList.contains("sf-list-item--icon"),c=t.classList.contains("sf-list-item--avatar"),d=t.classList.contains("sf-list-item--color"),f=Ye(e),u=d?"color":c?"avatar":"icon",p=document.createElement("div");p.className=`sf-tag transition sf-tag--${u} sf-tag--size-${s} sf-tag--inline${a} flex flex-row flex-nowrap items-center active`,p.dataset.value=n,f&&(p.classList.add("disabled"),p.setAttribute("aria-disabled","true"));const m=document.createElement("span");if(m.className="sf-tag-container",m.textContent=o,d){const e=t.querySelector(".sf-tag-color-icon"),n=document.createElement("span");n.className=e?.className||"sf-tag-color-icon",p.append(n)}else if(c){const e=t.querySelector(".sf-avatar");e&&p.append(e.cloneNode(!0))}else if(l){const e=document.createElement("i");e.className="sf-icon sf-tag-icon",e.textContent=t.querySelector(".sf-list-item-wrap > .sf-icon")?.textContent?.trim()||"favorite",p.append(e)}p.append(m);const h=document.createElement("button");h.type="button",h.className="sf-icon-button sf-icon-button--link sf-icon-button--on-surface sf-icon-button--size-1/3",h.setAttribute("aria-label",`Remove ${o}`),h.dataset.role="remove-tag",h.dataset.value=n,h.disabled=f,h.tabIndex=f?-1:0;const g=document.createElement("div");g.className="sf-close sf-close--size-1/3 flex";const w=document.createElement("div");return w.className="sf-close-icon",g.append(w),h.append(g),p.append(h),p}(e,n))}))}function ut(e){const t=et(e);t&&(t.value=Ke(e)?vt(e).map(at).join(","):e.dataset.selectedValue||"",t.disabled=Ye(e))}const pt=":scope > .sf-list-item-wrap :is(.sf-flag, .sf-icon, .sf-tag-color-icon, .sf-avatar):not(.sf-checkbox *)";function mt(e){const t=vt(e),n=Ke(e)?t:t.slice(0,1);!function(e,t){if(Be(e))return;const n=Je(e);n&&(n.value=t)}(e,n.map(lt).join(", ")),function(e,t){if(Be(e))return;const n=Ge(e),o=Je(e);if(!n||!o)return;if(n.querySelector(":scope > .sf-dropdown-field-visual")?.remove(),Ke(e)||1!==t.length)return;const r=t[0].querySelector(pt);if(!r)return;const i=r.cloneNode(!0);i.classList.add("sf-dropdown-field-visual"),i.setAttribute("aria-hidden","true"),i.classList.contains("sf-flag")&&(delete i.dataset.sfFlagReady,i.replaceChildren()),o.before(i)}(e,n),e.dataset.selectedValue=n.map(at).join(","),ft(e),ut(e)}function ht(e,t){const n=function(e){return e.querySelector(".sf-dropdown-field .sf-icon-button .sf-icon")}(e);n&&(n.textContent=t?"keyboard_arrow_up":"keyboard_arrow_down")}function gt(e,t=4){const n=function(e){return Qe(e)?.querySelector(".sf-list-container-wrap")||null}(e),o=tt(e);if(!n||!o||t<=0)return;const r=nt(e).filter(e=>!e.hidden);if(!r.length)return;const i=r[0].getBoundingClientRect().height;if(!i)return;const s=window.getComputedStyle(o),a=Number.parseFloat(s.rowGap||"")||Number.parseFloat(s.gap||"")||0,l=Number.parseFloat(s.paddingTop||"")||0,c=Number.parseFloat(s.paddingBottom||"")||0,d=Math.min(t,r.length),f=d*i+Math.max(d-1,0)*a+l+c;n.style.maxHeight=`${Math.ceil(f)}px`,n.style.overflowY=r.length>d?"auto":"hidden",n.style.overflowX="hidden"}function wt(e){if(!e||Ye(e))return;const t=Je(e);if(t&&t.disabled)return;const n=Qe(e);n&&(e.classList.add("sf-dropdown--open"),it(e),n.hidden=!1,ht(e,!0),gt(e,4),rt(e),e.__sfDropdownInteraction?.refresh())}function bt(e){if(!e)return;if(je(e))return void e.closest("sf-dropdown").closeDropdown();e.__sfDropdownInteraction?.beforeClose();const t=Qe(e);if(!t)return;e.classList.remove("sf-dropdown--open"),t.hidden=!0,ht(e,!1),st(e);const n=Ze(e);n&&(n.value="",yt(e,"")),e.__sfDropdownInteraction?.refresh()}function yt(e,t=""){const n=String(t).trim().toLowerCase();nt(e).forEach(e=>{const t=lt(e).toLowerCase();e.hidden=Boolean(n)&&!t.includes(n)}),gt(e,4),e.__sfDropdownInteraction?.refresh(),e.classList.contains("sf-dropdown--open")&&rt(e)}function vt(e){return nt(e).filter(e=>e.classList.contains("selected"))}function xt(e){const t=Ye(e),n=e.__sfDropdownDisabledState!==t;e.__sfDropdownDisabledState=t;const o=Ge(e),r=Je(e),i=Ze(e),s=e.querySelector(".sf-dropdown-field .sf-icon-button");e.removeAttribute("aria-disabled");const a=o?.querySelector(":scope > button")||o;a&&"BUTTON"!==a.tagName&&a.setAttribute("aria-disabled",t?"true":"false"),o&&o.classList.toggle("cursor-pointer",!t),r&&(r.disabled=t),i&&(i.disabled=t);const l=et(e);return l&&(l.disabled=t),s&&(s.disabled=t,s.tabIndex=t?-1:0),nt(e).forEach(e=>{e.tabIndex=t||e.classList.contains("disabled")?-1:0}),t&&e.classList.contains("sf-dropdown--open")&&bt(e),e.__sfDropdownInteraction?.refresh(),n}function _t(e,t){e&&(e.dispatchEvent(new CustomEvent("sf-dropdown:change",{bubbles:!0,composed:!0,detail:t})),e.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:t})))}function Lt(e,t){if(!e||!t||t.classList.contains("disabled")||Ye(e))return;const n=lt(t),o=at(t),r=Ke(e);if(r){const n=vt(e);ct(e,t.classList.contains("selected")?n.filter(e=>e!==t):[...n,t])}else ct(e,[t]);mt(e),_t(e,{value:o,label:n,values:r?vt(e).map(at):[o],item:t,root:e,multiple:r}),dt(e),r||bt(e)}function St(e){const t=e.currentTarget.__sfDropdownRoot||e.currentTarget;if(e.currentTarget!==t&&t.contains(e.currentTarget))return;if(Ye(t))return void e.preventDefault();const n=Ge(t),o=e.target.closest(".sf-list-item"),r=e.target.closest('[data-role="remove-tag"]'),i=e.target.closest(".sf-list .sf-input"),s=e.target.closest(".sf-list-item .sf-checkbox");if(!i||!ot(t,i)){if(s&&ot(t,s)&&e.preventDefault(),r&&ot(t,r)){e.preventDefault(),e.stopPropagation();const n=r.dataset.value,o=vt(t).filter(e=>at(e)!==n);return ct(t,o),mt(t),_t(t,{value:"",label:"",values:o.map(at),item:null,root:t,multiple:Ke(t)}),void dt(t)}if(o&&ot(t,o))return e.preventDefault(),void Lt(t,o);n?.contains(e.target)&&(e.target.closest(".sf-list")||(e.preventDefault(),function(e){e&&(e.classList.contains("sf-dropdown--open")?bt(e):(document.querySelectorAll(`${Ne}.sf-dropdown--open`).forEach(t=>{t!==e&&bt(t)}),wt(e)))}(t)))}}function Et(e){const t=e.currentTarget.__sfDropdownRoot||e.currentTarget;if(e.currentTarget!==t&&t.contains(e.currentTarget))return;if(Ye(t))return;if("Escape"===e.key)return void bt(t);const n=e.target.closest(".sf-list-item");n&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Lt(t,n)))}function Dt(e){const t=e.currentTarget.__sfDropdownRoot||e.currentTarget.closest(Ne);t&&!Ye(t)&&yt(t,e.currentTarget.value)}function At(e){if(function(e,t){if(e?.classList)for(const[n,o]of Object.entries(Me)){const o=`${t}--size-${n}`;e.classList.contains(o)&&e.classList.replace(o,`${t}--size-${$e(n,t)}`)}}(e,"sf-dropdown"),je(e))return;if(!e||"1"===e.dataset[Ve])return;const t=Ge(e),n=Qe(e),s=Je(e);if(!t||!n)return;e.dataset[Ve]="1",e.removeAttribute("aria-expanded"),s&&!Be(e)&&(s.readOnly=!0),n.hidden=!e.classList.contains("sf-dropdown--open"),ht(e,e.classList.contains("sf-dropdown--open")),gt(e,4),xt(e),dt(e),e.__sfDropdownStateObserver=new MutationObserver(t=>{const n=xt(e);dt(e),n&&ft(e),t.some(e=>["portal","data-portal"].includes(e.attributeName))&&(e.classList.contains("sf-dropdown--open")&&Xe(e)?it(e):st(e),e.__sfDropdownInteraction?.refresh())}),e.__sfDropdownStateObserver.observe(e,{attributes:!0,attributeFilter:["class","disabled","portal","data-portal"]});const a=tt(e);a&&!e.__sfDropdownItemsObserver&&(e.__sfDropdownItemsObserver=new MutationObserver(()=>{xt(e),dt(e)}),e.__sfDropdownItemsObserver.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","hidden","aria-hidden"]}));const l=vt(e);if(l.length>0)ct(e,l),mt(e);else{const t=e.getAttribute("value")||e.dataset.selectedValue||"";if(t){const n=Ke(e)?t.split(",").map(e=>e.trim()).filter(Boolean):[t],o=nt(e).filter(e=>n.includes(at(e))),r=o[0];r&&(ct(e,Ke(e)?o:[r]),mt(e))}}!l.length&&Be(e)&&(ft(e),ut(e)),e.__sfDropdownOnClick=St,e.__sfDropdownOnKeydown=Et,e.addEventListener("click",St),e.addEventListener("keydown",Et);const c=Ze(e);c&&(e.__sfDropdownSearchInput=c,e.__sfDropdownOnSearchInput=Dt,c.__sfDropdownRoot=e,c.addEventListener("input",Dt)),e.__sfDropdownInteraction=o(e,{getList:()=>Qe(e),isOpen:()=>e.classList.contains("sf-dropdown--open"),isDisabled:()=>Ye(e),isMultiple:()=>Ke(e),selectedLabels:()=>vt(e).map(lt),open:()=>wt(e),close:()=>bt(e),select:t=>Lt(e,t)}),Object.prototype.hasOwnProperty.call(e,"__sfDropdownResetValues")||(e.__sfDropdownResetValues=vt(e).map(at));const d=et(e)||t.querySelector(":scope > button")||s;d&&(e.__sfDropdownReleaseReset=function(e,t){const n=e.ownerDocument;i.has(n)||(n.addEventListener("reset",e=>{const t=e.target;if("FORM"!==t?.tagName)return;const n=Array.from(t.elements);setTimeout(()=>{if(!e.defaultPrevented)for(const e of n)if(e.isConnected&&e.form===t)for(const t of r.get(e)||[])t()},0)},!0),i.add(n));let o=r.get(e);return o||r.set(e,o=new Set),o.add(t),()=>o.delete(t)}(d,()=>{const t=nt(e).filter(t=>e.__sfDropdownResetValues.includes(at(t))),n=Ke(e)?t:t.slice(0,1);ct(e,n),mt(e),bt(e)}))}function kt(e){if(!e||"1"!==e.dataset[Ve])return;e.__sfDropdownInteraction?.release(),delete e.__sfDropdownInteraction,e.__sfDropdownReleaseReset?.(),delete e.__sfDropdownReleaseReset,st(e),e.__sfDropdownItemsObserver?.disconnect?.(),e.__sfDropdownStateObserver?.disconnect?.(),e.removeEventListener("click",e.__sfDropdownOnClick),e.removeEventListener("keydown",e.__sfDropdownOnKeydown);const t=Qe(e);t&&e.__sfDropdownPortalClick&&(t.removeEventListener("click",e.__sfDropdownPortalClick),t.removeEventListener("keydown",e.__sfDropdownPortalKeydown)),e.__sfDropdownSearchInput&&e.__sfDropdownOnSearchInput&&(e.__sfDropdownSearchInput.removeEventListener("input",e.__sfDropdownOnSearchInput),delete e.__sfDropdownSearchInput.__sfDropdownRoot),delete e.__sfDropdownOnClick,delete e.__sfDropdownOnKeydown,delete e.__sfDropdownPortalClick,delete e.__sfDropdownPortalKeydown,delete e.__sfDropdownSearchInput,delete e.__sfDropdownOnSearchInput,delete e.__sfDropdownItemsObserver,delete e.__sfDropdownStateObserver,delete e.__sfDropdownDisabledState,delete e.dataset[Ve]}function Ct(e=document){e.querySelectorAll(Ne).forEach(At)}document.__sfDropdownDocumentClickBound||(document.addEventListener("click",function(e){document.querySelectorAll(`${Ne}.sf-dropdown--open`).forEach(t=>{ot(t,e.target)||bt(t)})}),document.__sfDropdownDocumentClickBound=!0),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>Ct()):Ct();new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e instanceof Element&&(e.matches?.(Ne)&&At(e),Ct(e))}),e.removedNodes.forEach(e=>{e instanceof Element&&!e.isConnected&&(e.matches?.(Ne)&&kt(e),e.querySelectorAll?.(Ne).forEach(kt))})})}).observe(document.documentElement,{childList:!0,subtree:!0})})();
@@ -1 +1 @@
1
- (()=>{"use strict";class e{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(e){this.props=e,this.id=e?.id,this.params=e?.param,this.attrs=e?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(e){if(!Array.isArray(e))return[];const t=new Set;return e.forEach(e=>{if("string"!=typeof e)return;const n=e.match(/\(([^)]+)\)/g);n&&n.forEach(e=>{e.slice(1,-1).split(/\s+/).filter(Boolean).forEach(e=>{e.startsWith(".")&&e.length>1&&t.add(e.slice(1))})})}),Array.from(t)}applyLayoutUtilities(e,t){if(!e||!t)return;const n=this.getUtilityMap();if(!n||!n[t])return;this.extractUtilityClasses(n[t]).forEach(t=>e.classList.add(t))}render(){return this.html=this.template,"function"==typeof this.init&&this.init(),this.html&&window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:render`,{detail:this})),this.html}destroy(){this.destroyInternal?.(),this.props=null,this.id=null,this.params=null,this.template=null,this.html&&(this.html.remove(),this.html=null),window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:destroy`,{detail:this}))}destroyInternal(){}}const t=function(e,t){if(e&&t)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(e,t);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([e,t])}}else window.registerSfComponent(e,t)};function n(){const e=globalThis.SF=globalThis.SF||{};return e.__deprecationNotes instanceof Map||Object.defineProperty(e,"__deprecationNotes",{value:new Map,configurable:!0}),e.__deprecationNotes}function s({component:e="",kind:t="attribute",attribute:s="",from:o,to:i=null}={}){if(!o)return;const a=[e,t,s,o].join("|"),r=n(),l=r.get(a);if(l)l.count+=1;else if(r.set(a,{component:e,kind:t,attribute:s,from:o,to:i,count:1}),function(){const e=globalThis.document?.documentElement;return"warn"===e?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const n=e?`${e}: `:"",a="value"===t?`${s}="${o}"`:`${t} ${o}`;globalThis.console?.warn?.(`[Simai Framework] ${n}${a} is a legacy name${i?`; write ${i}`:""}. See contracts/changes/journal.json.`)}}if("undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const e=globalThis.SF.deprecations||{};e.list=function(){return[...n().values()].map(e=>({...e}))},e.clear=function(){n().clear()},e.note=s,globalThis.SF.deprecations=e}const o=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),a=new Set;function r(e,t="field",n="1"){const r=String(e??"").trim().toLowerCase();if(o.includes(r))return r;if(Object.hasOwn(i,r)){const e=i[r];s({component:t,kind:"value",attribute:"size",from:r,to:e});const n=`${t}:${r}`;return a.has(n)||"undefined"==typeof console||(a.add(n),console.warn(`[Simai Framework] ${t}: size ${r} is retired for form fields; rendering size ${e}.`)),e}return n}const l=(()=>{const e="undefined"!=typeof globalThis?globalThis:{},t="__sfPageLanguage";return e[t]||(e[t]={listeners:new Set,registered:new Map,chosen:null}),e[t]})(),c=l.listeners,d=l.registered,u=e=>String(e??"").trim().toLowerCase().replace("_","-"),f=()=>{for(const e of[...c])try{e()}catch{}};function p(e){let t=e;for(;t;){const e="function"==typeof t.closest?t.closest("[lang]"):null;if(e)return e;const n="function"==typeof t.getRootNode?t.getRootNode():null;t=n&&n!==t&&n.host?n.host:null}return null}function m(e){if(l.chosen)return l.chosen.split("-")[0];const t=p(e),n=t?.getAttribute("lang")||globalThis.document?.documentElement?.lang||"en";return u(n).split("-")[0]||"en"}function b(e){if(l.chosen)return l.chosen;const t=p(e);return u(t?.getAttribute("lang")||globalThis.document?.documentElement?.lang||"en")}function g(e,t,n,s){const o=s??(e=>{const t=e?.tagName;return"string"==typeof t?t.toLowerCase():null})(n);for(const s of(e=>{const t=u(e),n=t.split("-")[0],s=[];for(const e of[t,n,"en"])e&&!s.includes(e)&&s.push(e);return s})(b(n))){const n=o?d.get(o)?.get(s)?.[t]:void 0;if(void 0!==n)return n;const i=e?.[s]?.[t];if(void 0!==i)return i}return t}const h={current:(e=globalThis.document?.documentElement??null)=>b(e),use(e){const t=null==e?null:u(e);return t===l.chosen||(l.chosen=t,f()),l.chosen},register(e,t,n){const s=String(e??"").toLowerCase(),o=u(t);if(!s||!o)throw new TypeError("a component and a language are required");d.has(s)||d.set(s,new Map);const i=d.get(s);return null===n?i.delete(o):i.set(o,{...i.get(o)??{},...n}),f(),this},registerAll(e,t={}){for(const[n,s]of Object.entries(t))this.register(n,e,s);return this},known(e){const t=String(e??"").toLowerCase();return[...d.get(t)?.keys()??[]]},components:()=>[...d.keys()],onChange:e=>"function"!=typeof e?()=>{}:(c.add(e),()=>c.delete(e)),forget(){return d.clear(),l.chosen=null,f(),this}};"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.language=h,window.SF.pageLanguage=m,window.SF.pageText=g);const v={en:{remove:"Remove",uploading:"Uploading",retry:"Try again",linkText:"Click to upload",text:"or drag and drop"},ru:{remove:"Удалить",uploading:"Загрузка",retry:"Повторить",linkText:"Выберите файл",text:"или перетащите его сюда"}},_=".sf-file-upload",w="sfFileUploadBound";function F(e,t=!1){return null==e||""===e?t:"boolean"==typeof e?e:["1","true","yes","on","disabled","multiple"].includes(String(e).toLowerCase())}function y(e){return r(e,"sf-file-upload")}function E(e){const t=Number(e);if(!Number.isFinite(t)||t<0)return"";if(t<1024)return`${t} B`;const n=["KB","MB","GB","TB"];let s=t/1024,o=0;for(;s>=1024&&o<n.length-1;)s/=1024,o+=1;return`${s>=10?s.toFixed(0):s.toFixed(1)}${n[o]}`}function U(e){const t=String(e?.state||e?.status||"process").toLowerCase();return["process","done","error"].includes(t)?t:"process"}function x(e,t){return e?.id?String(e.id):e?.file&&e.file.name?`${e.file.name}-${e.file.size}-${e.file.lastModified}`:e?.name||e?.fileName?`${e.name||e.fileName}-${t}`:`item-${t}`}function S(e){return!!e&&(e.classList.contains("disabled")||e.hasAttribute("disabled"))}function C(e){return e?.querySelector?.('input[type="file"].sf-file-upload-input')||null}function L(e){if(!e)return null;const t=e.dataset.target||e.getAttribute("data-target")||"";if(t)try{const e=document.querySelector(t);if(e)return e}catch{}const n=e.nextElementSibling;return n?.classList?.contains("sf-file-upload-files")?n:e.querySelector(".sf-file-upload-files")||null}function N(e){return!!e&&("1"===e.dataset.renderManaged||e.hasAttribute("data-render-managed"))}function A(e){return e.hasAttribute("multiple")||F(e.dataset.multiple??e.getAttribute("multiple"),!1)}function O(e){return e.dataset.accept||e.getAttribute("accept")||""}function $(e,t){if(!e||!t)return;t.multiple=A(e);const n=O(e);n?t.setAttribute("accept",n):t.removeAttribute("accept"),t.disabled=S(e)}function k(e){const t=e.__sfFileUploadInteractionState||={tabIndex:e.getAttribute("tabindex")??"0",disabled:!1,buttons:new WeakMap},n=S(e);t.disabled||(t.tabIndex=e.getAttribute("tabindex")??"0");const s=n?"-1":t.tabIndex;e.getAttribute("tabindex")!==s&&e.setAttribute("tabindex",s),e.getAttribute("aria-disabled")!==String(n)&&e.setAttribute("aria-disabled",String(n)),t.disabled=n,$(e,C(e)),n&&e.classList.contains("dragover")&&e.classList.remove("dragover");const o=L(e);o?.querySelectorAll('button[data-action="remove"], button[data-action="retry"]').forEach(s=>{let o=t.buttons.get(s);o||(o={disabled:s.disabled,managedDisabled:!1,label:null},t.buttons.set(s,o)),o.managedDisabled||(o.disabled=s.disabled);const i=n||o.disabled;if(s.disabled!==i&&(s.disabled=i),o.managedDisabled=n,"remove"!==s.dataset.action)return;const a=s.getAttribute("aria-label");if(!(s.hasAttribute("aria-labelledby")||a&&a!==o.label)){const t=s.closest(".sf-upload-progress")?.querySelector(".sf-upload-progress-name")?.textContent?.trim()||"",n=`${g(v,"remove",e,"sf-file-upload")} ${t}`.trim();a!==n&&s.setAttribute("aria-label",n),o.label=n}s.querySelectorAll(".sf-icon").forEach(e=>{"true"!==e.getAttribute("aria-hidden")&&e.setAttribute("aria-hidden","true")})}),o?.querySelectorAll(".sf-upload-progress").forEach(t=>{const n=t.querySelector(".sf-upload-progress-name")?.textContent?.trim()||"",s=`${g(v,"uploading",e,"sf-file-upload")} ${n}`.trim(),o=t.querySelector("sf-progress-bar");if(o){const e=o.dataset.sfUploadLabel;return void(o.hasAttribute("label")&&o.getAttribute("label")!==e||(o.getAttribute("label")!==s&&o.setAttribute("label",s),o.dataset.sfUploadLabel=s))}const i=t.querySelector(".sf-progress-bar");if(!i||i.hasAttribute("aria-labelledby"))return;const a=i.getAttribute("aria-label");a&&a!==i.dataset.sfUploadLabel||(a!==s&&i.setAttribute("aria-label",s),i.dataset.label=s,i.dataset.sfUploadLabel=s)})}function T(e,t=[]){e?.classList?.toggle?.("has-files",t.length>0);const n=L(e);if(!n||N(e))return void(e&&k(e));n.innerHTML="";const s=y(Array.from(e.classList).find(e=>e.startsWith("sf-file-upload--size-"))?.replace("sf-file-upload--size-","")||"1");t.forEach((t,o)=>{const i=function(e,t="1",n=null){const s=y(t),o=String(e.state||e.status||"done").toLowerCase(),i=String(e.name||e.fileName||"File"),a=String(e.fileSize||e.sizeText||""),r=Math.max(0,Math.min(100,Number(e.progress??100)||0)),l=String(e.icon||"cloud_upload"),c=String(e.errorMessage||e.retryText||g(v,"retry",n,"sf-file-upload")),d=document.createElement("div");d.className=["sf-upload-progress",`sf-upload-progress--size-${s}`,`sf-upload-progress--${o}`,"flex","items-main-start","items-cross-start"].join(" ");const u=document.createElement("i");u.classList.add("sf-icon"),u.textContent=l;const f=document.createElement("div");f.className="sf-upload-progress-content flex flex-col flex-1";const p=document.createElement("div");p.className="sf-upload-progress-top flex content-main-between";const m=document.createElement("div");m.className="sf-upload-progress-left flex flex-col";const b=document.createElement("div");b.className="sf-upload-progress-name",b.textContent=i;const h=document.createElement("div");if(h.className="sf-upload-progress-text",h.textContent=a,m.append(b,h),p.append(m),"done"===o){const e=document.createElement("i");e.className="sf-icon sf-icon-solid",e.textContent="check_circle",p.append(e)}else{if("error"===o){const e=document.createElement("button");e.type="button",e.className=`sf-icon-button sf-icon-button--icon sf-icon-button--on-surface sf-icon-button--link sf-icon-button--size-${s} flex items-cross-center content-main-center self-cross-start`,e.dataset.action="remove";const t=document.createElement("i");t.className="sf-icon",t.textContent="delete",e.append(t),p.append(e);const n=document.createElement("button");return n.type="button",n.className="sf-upload-progress-repeat self-cross-start",n.dataset.action="retry",n.textContent=c,f.append(p,n),d.append(u,f),d}{const e=document.createElement("button");e.type="button",e.className=`sf-icon-button sf-icon-button--icon sf-icon-button--on-surface sf-icon-button--link sf-icon-button--size-${s} flex items-cross-center content-main-center self-cross-start`,e.dataset.action="remove";const t=document.createElement("i");t.className="sf-icon",t.textContent="delete",e.append(t),p.append(e)}}const _=document.createElement("div");_.className=`sf-progress-bar sf-progress-bar--size-${s} flex flex-row items-cross-center`,_.dataset.value=String(r),_.dataset.textPosition="inline-end";const w=document.createElement("div");w.className="sf-progress-bar-main";const F=document.createElement("div");F.className="sf-progress-bar-progress transition",F.style.width=`${r}%`;const E=document.createElement("div");return E.className="sf-progress-bar-text",E.textContent=`${r}%`,w.append(F),_.append(w,E),f.append(p,_),d.append(u,f),d}(t,s,e);i.dataset.index=String(o),n.append(i)}),k(e)}function I(e,t=[],n=[]){const s=new Map(n.map((e,t)=>[x(e,t),U(e)]));t.forEach((n,o)=>{const i=x(n,o),a=U(n),r=s.get(i);"error"===a&&"error"!==r&&function(e,t,n,s){e.dispatchEvent(new CustomEvent("sf-file-upload:file-error",{bubbles:!0,detail:{item:t,index:n,items:s}}))}(e,n,o,t),"done"===a&&"done"!==r&&function(e,t,n,s){e.dispatchEvent(new CustomEvent("sf-file-upload:file-complete",{bubbles:!0,detail:{item:t,index:n,items:s}}))}(e,n,o,t)});const o=t.length>0&&t.every(e=>"done"===U(e)),i=n.length>0&&n.every(e=>"done"===U(e));o&&!i&&function(e,t){e.dispatchEvent(new CustomEvent("sf-file-upload:complete",{bubbles:!0,detail:{items:t}}))}(e,t)}function D(e,t){if(!e)return!1;const n=Array.from(e.__sfFileUploadItems||[]);if(!n.length)return!1;const s=Number(t);if(!Number.isInteger(s)||s<0||s>=n.length)return!1;const[o]=n.splice(s,1);return e.__sfFileUploadItems=n,T(e,n),e.dispatchEvent(new CustomEvent("sf-file-upload:remove",{bubbles:!0,detail:{item:o||null,index:s,items:n}})),!0}function M(e,t=[],n="input"){const s=function(e=[]){return Array.from(e).map(e=>({id:`${e.name}-${e.size}-${e.lastModified}`,name:e.name,fileSize:E(e.size),progress:0,state:"process",file:e}))}(t),o=Array.from(e.__sfFileUploadItems||[]);e.__sfFileUploadItems=s,T(e,s),I(e,s,o),s.forEach((t,o)=>{!function(e,t,n,s,o="input"){e.dispatchEvent(new CustomEvent("sf-file-upload:file-add",{bubbles:!0,detail:{item:t,index:n,items:s,source:o,multiple:A(e)}}))}(e,t,o,s,n)}),function(e,t,n="input"){e.dispatchEvent(new CustomEvent("sf-file-upload:select",{bubbles:!0,detail:{files:t,source:n,multiple:A(e)}}))}(e,s,n)}function z(e){if(function(e,t){if(e?.classList)for(const[n,s]of Object.entries(i)){const s=`${t}--size-${n}`;e.classList.contains(s)&&e.classList.replace(s,`${t}--size-${r(n,t)}`)}}(e,"sf-file-upload"),!e)return;const t=function(e){let t=C(e);return t||(t=document.createElement("input"),t.type="file",t.classList.add("sf-file-upload-input"),t.hidden=!0,t.tabIndex=-1,t.setAttribute("aria-hidden","true"),e.append(t),t)}(e),n=L(e);if("function"==typeof e.__sfFileUploadOnClick){if(e.__sfFileUploadBoundInput===t&&e.__sfFileUploadBoundFiles===n)return;B(e)}else"1"!==e.dataset[w]||e.__sfFileUploadItems||N(e)||(e.__sfFileUploadItems=[],e.classList.contains("has-files")&&!e.hasAttribute("data-target")&&T(e,[]),e.classList.remove("has-files","dragover"));k(e),e.hasAttribute("role")||e.setAttribute("role","button");const s=()=>{S(e)||($(e,t),t.click())},o=t=>{if(S(e))return void t.preventDefault();const n=t.target;n instanceof Element&&(n.closest(".sf-upload-progress-repeat")||n.closest('input[type="file"]')||n.closest('[data-action="remove"]')||s())},a=t=>{t.target!==e||t.repeat||e.matches("button, input, a[href]")||S(e)||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s())},l=t=>{if(S(e))return;const n=Array.from(t.target?.files||[]);n.length&&(M(e,n,"input"),t.target.value="")},c=t=>{Array.from(t.dataTransfer?.types||[]).includes("Files")&&(t.preventDefault(),S(e)?t.dataTransfer.dropEffect="none":(t.dataTransfer.dropEffect="copy",e.classList.add("dragover")))},d=t=>{e.contains(t.relatedTarget)||e.classList.remove("dragover")},u=t=>{e.classList.remove("dragover");const n=Array.from(t.dataTransfer?.files||[]);if(!n.length&&!Array.from(t.dataTransfer?.types||[]).includes("Files"))return;if(t.preventDefault(),S(e)||!n.length)return;const s=n.filter(t=>function(e,t){const n=String(e||"").split(",").map(e=>e.trim().toLowerCase()).filter(Boolean);if(!n.length)return!0;const s=String(t?.name||"").toLowerCase(),o=String(t?.type||"").toLowerCase();return n.some(e=>e.startsWith(".")?s.endsWith(e):e.endsWith("/*")?o.startsWith(e.slice(0,-1)):o===e)}(O(e),t)),o=n.filter(e=>!s.includes(e));if(o.length&&e.dispatchEvent(new CustomEvent("sf-file-upload:reject",{bubbles:!0,detail:{files:o,accept:O(e),source:"drop"}})),!s.length)return;const i=A(e)?s:s.slice(0,1);M(e,i,"drop"),e.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{files:i,source:"drop"}}))},f=t=>{const n=t.target;if(!(n instanceof Element))return;const s=n.closest('[data-action="remove"]'),o=n.closest('[data-action="retry"]');if(!s&&!o)return;if(S(e)||(s||o).disabled)return t.preventDefault(),void t.stopPropagation();const i=(s||o).closest(".sf-upload-progress");i&&(t.preventDefault(),t.stopPropagation(),s?D(e,i.dataset.index):function(e,t){if(!e)return!1;const n=Array.from(e.__sfFileUploadItems||[]);if(!n.length)return!1;const s=Number(t);if(!Number.isInteger(s)||s<0||s>=n.length)return!1;const o=n.map(e=>({...e})),i=o[s];i.state="process",i.progress=0,delete i.errorMessage,delete i.retryText;const a=Array.from(e.__sfFileUploadItems||[]);e.__sfFileUploadItems=o,T(e,o),I(e,o,a),e.dispatchEvent(new CustomEvent("sf-file-upload:retry",{bubbles:!0,detail:{item:i,index:s,items:o}}))}(e,i.dataset.index))};e.addEventListener("click",o),e.addEventListener("keydown",a),e.addEventListener("dragover",c),e.addEventListener("dragleave",d),e.addEventListener("drop",u),t.addEventListener("change",l),n?.addEventListener("click",f),e.__sfFileUploadOnClick=o,e.__sfFileUploadOnKeydown=a,e.__sfFileUploadOnDragOver=c,e.__sfFileUploadOnDragLeave=d,e.__sfFileUploadOnDrop=u,e.__sfFileUploadOnChange=l,e.__sfFileUploadOnFilesClick=f,e.__sfFileUploadBoundInput=t,e.__sfFileUploadBoundFiles=n;const p=new MutationObserver(()=>k(e));p.observe(e,{attributes:!0,attributeFilter:["disabled","class","accept","multiple","data-accept","data-multiple"]}),n&&p.observe(n,{childList:!0,subtree:!0,characterData:!0}),e.__sfFileUploadInteractionObserver=p,e.dataset[w]="1"}function B(e){if(!e)return;const t=e.__sfFileUploadBoundInput||C(e);e.__sfFileUploadInteractionObserver?.disconnect(),delete e.__sfFileUploadInteractionObserver,e.__sfFileUploadOnClick&&e.removeEventListener("click",e.__sfFileUploadOnClick),e.__sfFileUploadOnKeydown&&e.removeEventListener("keydown",e.__sfFileUploadOnKeydown),e.__sfFileUploadOnDragOver&&e.removeEventListener("dragover",e.__sfFileUploadOnDragOver),e.__sfFileUploadOnDragLeave&&e.removeEventListener("dragleave",e.__sfFileUploadOnDragLeave),e.__sfFileUploadOnDrop&&e.removeEventListener("drop",e.__sfFileUploadOnDrop),t&&e.__sfFileUploadOnChange&&t.removeEventListener("change",e.__sfFileUploadOnChange);const n=e.__sfFileUploadBoundFiles||L(e);n&&e.__sfFileUploadOnFilesClick&&n.removeEventListener("click",e.__sfFileUploadOnFilesClick),delete e.__sfFileUploadOnClick,delete e.__sfFileUploadOnKeydown,delete e.__sfFileUploadOnDragOver,delete e.__sfFileUploadOnDragLeave,delete e.__sfFileUploadOnDrop,delete e.__sfFileUploadOnChange,delete e.__sfFileUploadOnFilesClick,delete e.__sfFileUploadBoundInput,delete e.__sfFileUploadBoundFiles,delete e.dataset[w]}function q(e=document){e.querySelectorAll(_).forEach(j)}function j(e){e.isConnected&&!e.closest("sf-file-upload")&&z(e)}function P(e,t=[]){const n=e instanceof HTMLElement?e.closest(_)||e:null;if(!n)return!1;const s=Array.from(n.__sfFileUploadItems||[]);return n.__sfFileUploadItems=Array.isArray(t)?t:[],T(n,n.__sfFileUploadItems),I(n,n.__sfFileUploadItems,s),!0}t("FileUpload",class extends e{static componentName="FileUpload";constructor(e){super(e);const{size:t="1",accept:n="",multiple:s=!1,disabled:o=!1,icon:i="cloud_upload",linkText:a,text:r,supportingText:l="",label:c=""}=this.params||{},d=y(t),u=document.createElement("div");u.className="sf-file-upload-wrap flex flex-col gap-1";const f=document.createElement("div");this.id&&(f.id=this.id),f.className=`sf-file-upload sf-file-upload--size-${d} flex flex-col items-cross-center cursor-pointer`;const p=this.attrs.class||this.attrs.className;p&&f.classList.add(...String(p).split(" ").filter(Boolean)),n&&(f.dataset.accept=n),f.dataset.multiple=F(s)?"true":"false",F(s)&&f.setAttribute("multiple",""),F(o)&&f.setAttribute("disabled",""),c&&f.setAttribute("aria-label",c),f.tabIndex=0;const m=document.createElement("div");m.className=`sf-featured-icon sf-featured-icon--size-${d} sf-featured-icon--soft sf-featured-icon--circle sf-featured-icon--neutral`;const b=document.createElement("i");b.className="sf-icon",b.textContent=i,m.append(b);const h=document.createElement("div");h.className="sf-file-upload-bottom flex flex-col items-cross-center";const _=document.createElement("div");_.className="sf-file-upload-block flex";const w=document.createElement("div");w.className="sf-file-upload-block-text";const E=document.createElement("span");if(E.className="sf-file-upload-link",E.textContent=a??g(v,"linkText",f,"sf-file-upload"),w.append(E,` ${r??g(v,"text",f,"sf-file-upload")}`),_.append(w),h.append(_),l){const e=document.createElement("span");e.className="sf-file-upload-text",e.textContent=l,h.append(e)}f.append(m,h);const U=document.createElement("div");U.className="sf-file-upload-files grid grid-col-1 gap-1 w-full",u.append(f,U),this.root=f,this.template=u}init(){z(this.root)}destroyInternal(){B(this.root)}}),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.FileUpload=window.SF.FileUpload||{},window.SF.FileUpload.getItems=function(e){const t=e instanceof HTMLElement?e.closest(_)||e:null;return t?Array.from(t.__sfFileUploadItems||[]):[]},window.SF.FileUpload.setItems=P,window.SF.FileUpload.clear=function(e){return P(e,[])},window.SF.FileUpload.removeItem=D),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>q(),{once:!0}):q();new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e instanceof Element&&(e.matches?.(_)&&j(e),q(e))}),e.removedNodes.forEach(e=>{if(!(e instanceof Element)||e.isConnected)return;const t=[...e.querySelectorAll(_)];e.matches(_)&&t.push(e),t.forEach(e=>{e.isConnected||e.closest("sf-file-upload")||B(e)})})})}).observe(document.documentElement,{childList:!0,subtree:!0})})();
1
+ (()=>{"use strict";class e{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(e){this.props=e,this.id=e?.id,this.params=e?.param,this.attrs=e?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(e){if(!Array.isArray(e))return[];const t=new Set;return e.forEach(e=>{if("string"!=typeof e)return;const n=e.match(/\(([^)]+)\)/g);n&&n.forEach(e=>{e.slice(1,-1).split(/\s+/).filter(Boolean).forEach(e=>{e.startsWith(".")&&e.length>1&&t.add(e.slice(1))})})}),Array.from(t)}applyLayoutUtilities(e,t){if(!e||!t)return;const n=this.getUtilityMap();if(!n||!n[t])return;this.extractUtilityClasses(n[t]).forEach(t=>e.classList.add(t))}render(){return this.html=this.template,"function"==typeof this.init&&this.init(),this.html&&window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:render`,{detail:this})),this.html}destroy(){this.destroyInternal?.(),this.props=null,this.id=null,this.params=null,this.template=null,this.html&&(this.html.remove(),this.html=null),window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:destroy`,{detail:this}))}destroyInternal(){}}const t=function(e,t){if(e&&t)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(e,t);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([e,t])}}else window.registerSfComponent(e,t)};function n(){const e=globalThis.SF=globalThis.SF||{};return e.__deprecationNotes instanceof Map||Object.defineProperty(e,"__deprecationNotes",{value:new Map,configurable:!0}),e.__deprecationNotes}function s({component:e="",kind:t="attribute",attribute:s="",from:o,to:i=null}={}){if(!o)return;const a=[e,t,s,o].join("|"),r=n(),l=r.get(a);if(l)l.count+=1;else if(r.set(a,{component:e,kind:t,attribute:s,from:o,to:i,count:1}),function(){const e=globalThis.document?.documentElement;return"warn"===e?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const n=e?`${e}: `:"",a="value"===t?`${s}="${o}"`:`${t} ${o}`;globalThis.console?.warn?.(`[SIMAI Framework] ${n}${a} is a legacy name${i?`; write ${i}`:""}. See contracts/changes/journal.json.`)}}if("undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const e=globalThis.SF.deprecations||{};e.list=function(){return[...n().values()].map(e=>({...e}))},e.clear=function(){n().clear()},e.note=s,globalThis.SF.deprecations=e}const o=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),a=new Set;function r(e,t="field",n="1"){const r=String(e??"").trim().toLowerCase();if(o.includes(r))return r;if(Object.hasOwn(i,r)){const e=i[r];s({component:t,kind:"value",attribute:"size",from:r,to:e});const n=`${t}:${r}`;return a.has(n)||"undefined"==typeof console||(a.add(n),console.warn(`[SIMAI Framework] ${t}: size ${r} is retired for form fields; rendering size ${e}.`)),e}return n}const l=(()=>{const e="undefined"!=typeof globalThis?globalThis:{},t="__sfPageLanguage";return e[t]||(e[t]={listeners:new Set,registered:new Map,chosen:null}),e[t]})(),c=l.listeners,d=l.registered,u=e=>String(e??"").trim().toLowerCase().replace("_","-"),f=()=>{for(const e of[...c])try{e()}catch{}};function p(e){let t=e;for(;t;){const e="function"==typeof t.closest?t.closest("[lang]"):null;if(e)return e;const n="function"==typeof t.getRootNode?t.getRootNode():null;t=n&&n!==t&&n.host?n.host:null}return null}function m(e){if(l.chosen)return l.chosen.split("-")[0];const t=p(e),n=t?.getAttribute("lang")||globalThis.document?.documentElement?.lang||"en";return u(n).split("-")[0]||"en"}function b(e){if(l.chosen)return l.chosen;const t=p(e);return u(t?.getAttribute("lang")||globalThis.document?.documentElement?.lang||"en")}function g(e,t,n,s){const o=s??(e=>{const t=e?.tagName;return"string"==typeof t?t.toLowerCase():null})(n);for(const s of(e=>{const t=u(e),n=t.split("-")[0],s=[];for(const e of[t,n,"en"])e&&!s.includes(e)&&s.push(e);return s})(b(n))){const n=o?d.get(o)?.get(s)?.[t]:void 0;if(void 0!==n)return n;const i=e?.[s]?.[t];if(void 0!==i)return i}return t}const h={current:(e=globalThis.document?.documentElement??null)=>b(e),use(e){const t=null==e?null:u(e);return t===l.chosen||(l.chosen=t,f()),l.chosen},register(e,t,n){const s=String(e??"").toLowerCase(),o=u(t);if(!s||!o)throw new TypeError("a component and a language are required");d.has(s)||d.set(s,new Map);const i=d.get(s);return null===n?i.delete(o):i.set(o,{...i.get(o)??{},...n}),f(),this},registerAll(e,t={}){for(const[n,s]of Object.entries(t))this.register(n,e,s);return this},known(e){const t=String(e??"").toLowerCase();return[...d.get(t)?.keys()??[]]},components:()=>[...d.keys()],onChange:e=>"function"!=typeof e?()=>{}:(c.add(e),()=>c.delete(e)),forget(){return d.clear(),l.chosen=null,f(),this}};"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.language=h,window.SF.pageLanguage=m,window.SF.pageText=g);const v={en:{remove:"Remove",uploading:"Uploading",retry:"Try again",linkText:"Click to upload",text:"or drag and drop"},ru:{remove:"Удалить",uploading:"Загрузка",retry:"Повторить",linkText:"Выберите файл",text:"или перетащите его сюда"}},_=".sf-file-upload",w="sfFileUploadBound";function F(e,t=!1){return null==e||""===e?t:"boolean"==typeof e?e:["1","true","yes","on","disabled","multiple"].includes(String(e).toLowerCase())}function y(e){return r(e,"sf-file-upload")}function E(e){const t=Number(e);if(!Number.isFinite(t)||t<0)return"";if(t<1024)return`${t} B`;const n=["KB","MB","GB","TB"];let s=t/1024,o=0;for(;s>=1024&&o<n.length-1;)s/=1024,o+=1;return`${s>=10?s.toFixed(0):s.toFixed(1)}${n[o]}`}function U(e){const t=String(e?.state||e?.status||"process").toLowerCase();return["process","done","error"].includes(t)?t:"process"}function x(e,t){return e?.id?String(e.id):e?.file&&e.file.name?`${e.file.name}-${e.file.size}-${e.file.lastModified}`:e?.name||e?.fileName?`${e.name||e.fileName}-${t}`:`item-${t}`}function S(e){return!!e&&(e.classList.contains("disabled")||e.hasAttribute("disabled"))}function C(e){return e?.querySelector?.('input[type="file"].sf-file-upload-input')||null}function L(e){if(!e)return null;const t=e.dataset.target||e.getAttribute("data-target")||"";if(t)try{const e=document.querySelector(t);if(e)return e}catch{}const n=e.nextElementSibling;return n?.classList?.contains("sf-file-upload-files")?n:e.querySelector(".sf-file-upload-files")||null}function A(e){return!!e&&("1"===e.dataset.renderManaged||e.hasAttribute("data-render-managed"))}function N(e){return e.hasAttribute("multiple")||F(e.dataset.multiple??e.getAttribute("multiple"),!1)}function O(e){return e.dataset.accept||e.getAttribute("accept")||""}function $(e,t){if(!e||!t)return;t.multiple=N(e);const n=O(e);n?t.setAttribute("accept",n):t.removeAttribute("accept"),t.disabled=S(e)}function I(e){const t=e.__sfFileUploadInteractionState||={tabIndex:e.getAttribute("tabindex")??"0",disabled:!1,buttons:new WeakMap},n=S(e);t.disabled||(t.tabIndex=e.getAttribute("tabindex")??"0");const s=n?"-1":t.tabIndex;e.getAttribute("tabindex")!==s&&e.setAttribute("tabindex",s),e.getAttribute("aria-disabled")!==String(n)&&e.setAttribute("aria-disabled",String(n)),t.disabled=n,$(e,C(e)),n&&e.classList.contains("dragover")&&e.classList.remove("dragover");const o=L(e);o?.querySelectorAll('button[data-action="remove"], button[data-action="retry"]').forEach(s=>{let o=t.buttons.get(s);o||(o={disabled:s.disabled,managedDisabled:!1,label:null},t.buttons.set(s,o)),o.managedDisabled||(o.disabled=s.disabled);const i=n||o.disabled;if(s.disabled!==i&&(s.disabled=i),o.managedDisabled=n,"remove"!==s.dataset.action)return;const a=s.getAttribute("aria-label");if(!(s.hasAttribute("aria-labelledby")||a&&a!==o.label)){const t=s.closest(".sf-upload-progress")?.querySelector(".sf-upload-progress-name")?.textContent?.trim()||"",n=`${g(v,"remove",e,"sf-file-upload")} ${t}`.trim();a!==n&&s.setAttribute("aria-label",n),o.label=n}s.querySelectorAll(".sf-icon").forEach(e=>{"true"!==e.getAttribute("aria-hidden")&&e.setAttribute("aria-hidden","true")})}),o?.querySelectorAll(".sf-upload-progress").forEach(t=>{const n=t.querySelector(".sf-upload-progress-name")?.textContent?.trim()||"",s=`${g(v,"uploading",e,"sf-file-upload")} ${n}`.trim(),o=t.querySelector("sf-progress-bar");if(o){const e=o.dataset.sfUploadLabel;return void(o.hasAttribute("label")&&o.getAttribute("label")!==e||(o.getAttribute("label")!==s&&o.setAttribute("label",s),o.dataset.sfUploadLabel=s))}const i=t.querySelector(".sf-progress-bar");if(!i||i.hasAttribute("aria-labelledby"))return;const a=i.getAttribute("aria-label");a&&a!==i.dataset.sfUploadLabel||(a!==s&&i.setAttribute("aria-label",s),i.dataset.label=s,i.dataset.sfUploadLabel=s)})}function k(e,t=[]){e?.classList?.toggle?.("has-files",t.length>0);const n=L(e);if(!n||A(e))return void(e&&I(e));n.innerHTML="";const s=y(Array.from(e.classList).find(e=>e.startsWith("sf-file-upload--size-"))?.replace("sf-file-upload--size-","")||"1");t.forEach((t,o)=>{const i=function(e,t="1",n=null){const s=y(t),o=String(e.state||e.status||"done").toLowerCase(),i=String(e.name||e.fileName||"File"),a=String(e.fileSize||e.sizeText||""),r=Math.max(0,Math.min(100,Number(e.progress??100)||0)),l=String(e.icon||"cloud_upload"),c=String(e.errorMessage||e.retryText||g(v,"retry",n,"sf-file-upload")),d=document.createElement("div");d.className=["sf-upload-progress",`sf-upload-progress--size-${s}`,`sf-upload-progress--${o}`,"flex","items-main-start","items-cross-start"].join(" ");const u=document.createElement("i");u.classList.add("sf-icon"),u.textContent=l;const f=document.createElement("div");f.className="sf-upload-progress-content flex flex-col flex-1";const p=document.createElement("div");p.className="sf-upload-progress-top flex content-main-between";const m=document.createElement("div");m.className="sf-upload-progress-left flex flex-col";const b=document.createElement("div");b.className="sf-upload-progress-name",b.textContent=i;const h=document.createElement("div");if(h.className="sf-upload-progress-text",h.textContent=a,m.append(b,h),p.append(m),"done"===o){const e=document.createElement("i");e.className="sf-icon sf-icon-solid",e.textContent="check_circle",p.append(e)}else{if("error"===o){const e=document.createElement("button");e.type="button",e.className=`sf-icon-button sf-icon-button--icon sf-icon-button--on-surface sf-icon-button--link sf-icon-button--size-${s} flex items-cross-center content-main-center self-cross-start`,e.dataset.action="remove";const t=document.createElement("i");t.className="sf-icon",t.textContent="delete",e.append(t),p.append(e);const n=document.createElement("button");return n.type="button",n.className="sf-upload-progress-repeat self-cross-start",n.dataset.action="retry",n.textContent=c,f.append(p,n),d.append(u,f),d}{const e=document.createElement("button");e.type="button",e.className=`sf-icon-button sf-icon-button--icon sf-icon-button--on-surface sf-icon-button--link sf-icon-button--size-${s} flex items-cross-center content-main-center self-cross-start`,e.dataset.action="remove";const t=document.createElement("i");t.className="sf-icon",t.textContent="delete",e.append(t),p.append(e)}}const _=document.createElement("div");_.className=`sf-progress-bar sf-progress-bar--size-${s} flex flex-row items-cross-center`,_.dataset.value=String(r),_.dataset.textPosition="inline-end";const w=document.createElement("div");w.className="sf-progress-bar-main";const F=document.createElement("div");F.className="sf-progress-bar-progress transition",F.style.width=`${r}%`;const E=document.createElement("div");return E.className="sf-progress-bar-text",E.textContent=`${r}%`,w.append(F),_.append(w,E),f.append(p,_),d.append(u,f),d}(t,s,e);i.dataset.index=String(o),n.append(i)}),I(e)}function T(e,t=[],n=[]){const s=new Map(n.map((e,t)=>[x(e,t),U(e)]));t.forEach((n,o)=>{const i=x(n,o),a=U(n),r=s.get(i);"error"===a&&"error"!==r&&function(e,t,n,s){e.dispatchEvent(new CustomEvent("sf-file-upload:file-error",{bubbles:!0,detail:{item:t,index:n,items:s}}))}(e,n,o,t),"done"===a&&"done"!==r&&function(e,t,n,s){e.dispatchEvent(new CustomEvent("sf-file-upload:file-complete",{bubbles:!0,detail:{item:t,index:n,items:s}}))}(e,n,o,t)});const o=t.length>0&&t.every(e=>"done"===U(e)),i=n.length>0&&n.every(e=>"done"===U(e));o&&!i&&function(e,t){e.dispatchEvent(new CustomEvent("sf-file-upload:complete",{bubbles:!0,detail:{items:t}}))}(e,t)}function M(e,t){if(!e)return!1;const n=Array.from(e.__sfFileUploadItems||[]);if(!n.length)return!1;const s=Number(t);if(!Number.isInteger(s)||s<0||s>=n.length)return!1;const[o]=n.splice(s,1);return e.__sfFileUploadItems=n,k(e,n),e.dispatchEvent(new CustomEvent("sf-file-upload:remove",{bubbles:!0,detail:{item:o||null,index:s,items:n}})),!0}function D(e,t=[],n="input"){const s=function(e=[]){return Array.from(e).map(e=>({id:`${e.name}-${e.size}-${e.lastModified}`,name:e.name,fileSize:E(e.size),progress:0,state:"process",file:e}))}(t),o=Array.from(e.__sfFileUploadItems||[]);e.__sfFileUploadItems=s,k(e,s),T(e,s,o),s.forEach((t,o)=>{!function(e,t,n,s,o="input"){e.dispatchEvent(new CustomEvent("sf-file-upload:file-add",{bubbles:!0,detail:{item:t,index:n,items:s,source:o,multiple:N(e)}}))}(e,t,o,s,n)}),function(e,t,n="input"){e.dispatchEvent(new CustomEvent("sf-file-upload:select",{bubbles:!0,detail:{files:t,source:n,multiple:N(e)}}))}(e,s,n)}function z(e){if(function(e,t){if(e?.classList)for(const[n,s]of Object.entries(i)){const s=`${t}--size-${n}`;e.classList.contains(s)&&e.classList.replace(s,`${t}--size-${r(n,t)}`)}}(e,"sf-file-upload"),!e)return;const t=function(e){let t=C(e);return t||(t=document.createElement("input"),t.type="file",t.classList.add("sf-file-upload-input"),t.hidden=!0,t.tabIndex=-1,t.setAttribute("aria-hidden","true"),e.append(t),t)}(e),n=L(e);if("function"==typeof e.__sfFileUploadOnClick){if(e.__sfFileUploadBoundInput===t&&e.__sfFileUploadBoundFiles===n)return;B(e)}else"1"!==e.dataset[w]||e.__sfFileUploadItems||A(e)||(e.__sfFileUploadItems=[],e.classList.contains("has-files")&&!e.hasAttribute("data-target")&&k(e,[]),e.classList.remove("has-files","dragover"));I(e),e.hasAttribute("role")||e.setAttribute("role","button");const s=()=>{S(e)||($(e,t),t.click())},o=t=>{if(S(e))return void t.preventDefault();const n=t.target;n instanceof Element&&(n.closest(".sf-upload-progress-repeat")||n.closest('input[type="file"]')||n.closest('[data-action="remove"]')||s())},a=t=>{t.target!==e||t.repeat||e.matches("button, input, a[href]")||S(e)||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s())},l=t=>{if(S(e))return;const n=Array.from(t.target?.files||[]);n.length&&(D(e,n,"input"),t.target.value="")},c=t=>{Array.from(t.dataTransfer?.types||[]).includes("Files")&&(t.preventDefault(),S(e)?t.dataTransfer.dropEffect="none":(t.dataTransfer.dropEffect="copy",e.classList.add("dragover")))},d=t=>{e.contains(t.relatedTarget)||e.classList.remove("dragover")},u=t=>{e.classList.remove("dragover");const n=Array.from(t.dataTransfer?.files||[]);if(!n.length&&!Array.from(t.dataTransfer?.types||[]).includes("Files"))return;if(t.preventDefault(),S(e)||!n.length)return;const s=n.filter(t=>function(e,t){const n=String(e||"").split(",").map(e=>e.trim().toLowerCase()).filter(Boolean);if(!n.length)return!0;const s=String(t?.name||"").toLowerCase(),o=String(t?.type||"").toLowerCase();return n.some(e=>e.startsWith(".")?s.endsWith(e):e.endsWith("/*")?o.startsWith(e.slice(0,-1)):o===e)}(O(e),t)),o=n.filter(e=>!s.includes(e));if(o.length&&e.dispatchEvent(new CustomEvent("sf-file-upload:reject",{bubbles:!0,detail:{files:o,accept:O(e),source:"drop"}})),!s.length)return;const i=N(e)?s:s.slice(0,1);D(e,i,"drop"),e.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{files:i,source:"drop"}}))},f=t=>{const n=t.target;if(!(n instanceof Element))return;const s=n.closest('[data-action="remove"]'),o=n.closest('[data-action="retry"]');if(!s&&!o)return;if(S(e)||(s||o).disabled)return t.preventDefault(),void t.stopPropagation();const i=(s||o).closest(".sf-upload-progress");i&&(t.preventDefault(),t.stopPropagation(),s?M(e,i.dataset.index):function(e,t){if(!e)return!1;const n=Array.from(e.__sfFileUploadItems||[]);if(!n.length)return!1;const s=Number(t);if(!Number.isInteger(s)||s<0||s>=n.length)return!1;const o=n.map(e=>({...e})),i=o[s];i.state="process",i.progress=0,delete i.errorMessage,delete i.retryText;const a=Array.from(e.__sfFileUploadItems||[]);e.__sfFileUploadItems=o,k(e,o),T(e,o,a),e.dispatchEvent(new CustomEvent("sf-file-upload:retry",{bubbles:!0,detail:{item:i,index:s,items:o}}))}(e,i.dataset.index))};e.addEventListener("click",o),e.addEventListener("keydown",a),e.addEventListener("dragover",c),e.addEventListener("dragleave",d),e.addEventListener("drop",u),t.addEventListener("change",l),n?.addEventListener("click",f),e.__sfFileUploadOnClick=o,e.__sfFileUploadOnKeydown=a,e.__sfFileUploadOnDragOver=c,e.__sfFileUploadOnDragLeave=d,e.__sfFileUploadOnDrop=u,e.__sfFileUploadOnChange=l,e.__sfFileUploadOnFilesClick=f,e.__sfFileUploadBoundInput=t,e.__sfFileUploadBoundFiles=n;const p=new MutationObserver(()=>I(e));p.observe(e,{attributes:!0,attributeFilter:["disabled","class","accept","multiple","data-accept","data-multiple"]}),n&&p.observe(n,{childList:!0,subtree:!0,characterData:!0}),e.__sfFileUploadInteractionObserver=p,e.dataset[w]="1"}function B(e){if(!e)return;const t=e.__sfFileUploadBoundInput||C(e);e.__sfFileUploadInteractionObserver?.disconnect(),delete e.__sfFileUploadInteractionObserver,e.__sfFileUploadOnClick&&e.removeEventListener("click",e.__sfFileUploadOnClick),e.__sfFileUploadOnKeydown&&e.removeEventListener("keydown",e.__sfFileUploadOnKeydown),e.__sfFileUploadOnDragOver&&e.removeEventListener("dragover",e.__sfFileUploadOnDragOver),e.__sfFileUploadOnDragLeave&&e.removeEventListener("dragleave",e.__sfFileUploadOnDragLeave),e.__sfFileUploadOnDrop&&e.removeEventListener("drop",e.__sfFileUploadOnDrop),t&&e.__sfFileUploadOnChange&&t.removeEventListener("change",e.__sfFileUploadOnChange);const n=e.__sfFileUploadBoundFiles||L(e);n&&e.__sfFileUploadOnFilesClick&&n.removeEventListener("click",e.__sfFileUploadOnFilesClick),delete e.__sfFileUploadOnClick,delete e.__sfFileUploadOnKeydown,delete e.__sfFileUploadOnDragOver,delete e.__sfFileUploadOnDragLeave,delete e.__sfFileUploadOnDrop,delete e.__sfFileUploadOnChange,delete e.__sfFileUploadOnFilesClick,delete e.__sfFileUploadBoundInput,delete e.__sfFileUploadBoundFiles,delete e.dataset[w]}function q(e=document){e.querySelectorAll(_).forEach(j)}function j(e){e.isConnected&&!e.closest("sf-file-upload")&&z(e)}function P(e,t=[]){const n=e instanceof HTMLElement?e.closest(_)||e:null;if(!n)return!1;const s=Array.from(n.__sfFileUploadItems||[]);return n.__sfFileUploadItems=Array.isArray(t)?t:[],k(n,n.__sfFileUploadItems),T(n,n.__sfFileUploadItems,s),!0}t("FileUpload",class extends e{static componentName="FileUpload";constructor(e){super(e);const{size:t="1",accept:n="",multiple:s=!1,disabled:o=!1,icon:i="cloud_upload",linkText:a,text:r,supportingText:l="",label:c=""}=this.params||{},d=y(t),u=document.createElement("div");u.className="sf-file-upload-wrap flex flex-col gap-1";const f=document.createElement("div");this.id&&(f.id=this.id),f.className=`sf-file-upload sf-file-upload--size-${d} flex flex-col items-cross-center cursor-pointer`;const p=this.attrs.class||this.attrs.className;p&&f.classList.add(...String(p).split(" ").filter(Boolean)),n&&(f.dataset.accept=n),f.dataset.multiple=F(s)?"true":"false",F(s)&&f.setAttribute("multiple",""),F(o)&&f.setAttribute("disabled",""),c&&f.setAttribute("aria-label",c),f.tabIndex=0;const m=document.createElement("div");m.className=`sf-featured-icon sf-featured-icon--size-${d} sf-featured-icon--soft sf-featured-icon--circle sf-featured-icon--neutral`;const b=document.createElement("i");b.className="sf-icon",b.textContent=i,m.append(b);const h=document.createElement("div");h.className="sf-file-upload-bottom flex flex-col items-cross-center";const _=document.createElement("div");_.className="sf-file-upload-block flex";const w=document.createElement("div");w.className="sf-file-upload-block-text";const E=document.createElement("span");if(E.className="sf-file-upload-link",E.textContent=a??g(v,"linkText",f,"sf-file-upload"),w.append(E,` ${r??g(v,"text",f,"sf-file-upload")}`),_.append(w),h.append(_),l){const e=document.createElement("span");e.className="sf-file-upload-text",e.textContent=l,h.append(e)}f.append(m,h);const U=document.createElement("div");U.className="sf-file-upload-files grid grid-col-1 gap-1 w-full",u.append(f,U),this.root=f,this.template=u}init(){z(this.root)}destroyInternal(){B(this.root)}}),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.FileUpload=window.SF.FileUpload||{},window.SF.FileUpload.getItems=function(e){const t=e instanceof HTMLElement?e.closest(_)||e:null;return t?Array.from(t.__sfFileUploadItems||[]):[]},window.SF.FileUpload.setItems=P,window.SF.FileUpload.clear=function(e){return P(e,[])},window.SF.FileUpload.removeItem=M),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>q(),{once:!0}):q();new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e instanceof Element&&(e.matches?.(_)&&j(e),q(e))}),e.removedNodes.forEach(e=>{if(!(e instanceof Element)||e.isConnected)return;const t=[...e.querySelectorAll(_)];e.matches(_)&&t.push(e),t.forEach(e=>{e.isConnected||e.closest("sf-file-upload")||B(e)})})})}).observe(document.documentElement,{childList:!0,subtree:!0})})();
@@ -1 +1 @@
1
- (()=>{"use strict";class t{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(t){this.props=t,this.id=t?.id,this.params=t?.param,this.attrs=t?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(t){if(!Array.isArray(t))return[];const e=new Set;return t.forEach(t=>{if("string"!=typeof t)return;const n=t.match(/\(([^)]+)\)/g);n&&n.forEach(t=>{t.slice(1,-1).split(/\s+/).filter(Boolean).forEach(t=>{t.startsWith(".")&&t.length>1&&e.add(t.slice(1))})})}),Array.from(e)}applyLayoutUtilities(t,e){if(!t||!e)return;const n=this.getUtilityMap();if(!n||!n[e])return;this.extractUtilityClasses(n[e]).forEach(e=>t.classList.add(e))}render(){return this.html=this.template,"function"==typeof this.init&&this.init(),this.html&&window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:render`,{detail:this})),this.html}destroy(){this.destroyInternal?.(),this.props=null,this.id=null,this.params=null,this.template=null,this.html&&(this.html.remove(),this.html=null),window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:destroy`,{detail:this}))}destroyInternal(){}}const e=function(t,e){if(t&&e)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(t,e);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([t,e])}}else window.registerSfComponent(t,e)},n=JSON.parse('{".sf-input":["display/flex (.flex)","flex-direction/column (.flex-col)","flex-wrap/nowrap (.flex-nowrap)","gap/var(--sf-space-1\\\\/4)","justify-content/flex-start (.justify-start)"],".sf-input .sf-input-field":["display/flex (.flex)","flex-direction/row (.flex-row)","flex-wrap/nowrap (.flex-nowrap)","justify-content/flex-start (.justify-start)","align-items/center (.items-center)"],".sf-input .sf-input-label":["display/flex (.flex)","flex-direction/row (.flex-row)","align-items/flex-start (.items-start)"],".sf-input .sf-input-field input":["flex/1 (.flex-1)"],".sf-input .sf-input-field .sf-icon":["display/flex (.flex)","justify-content/flex-start (.justify-start)","align-items/center (.items-center)"],".sf-input .sf-input-text-container":["flex/1 (.flex-1)","display/flex (.flex)","flex-direction/row (.flex-row)","flex-wrap/nowrap (.flex-nowrap)","justify-content/flex-start (.justify-start)","align-items/center (.items-center)"],".sf-input .sf-input-group":["display/flex (.flex)","flex-direction/column (.flex-col)","flex-wrap/nowrap (.flex-nowrap)","justify-content/center (.justify-center)","align-items/flex-start (.items-start)"],".sf-input .sf-input-text-container-alt":["display/flex (.flex)","flex-direction/row (.flex-row)","flex-wrap/nowrap (.flex-nowrap)","justify-content/center (.justify-center)","align-items/center (.items-center)"],".sf-input .sf-icon-alt":["display/flex (.flex)","justify-content/flex-start (.justify-start)","align-items/center (.items-center)"],".sf-input .sf-input-hint-text-wrap":["flex/1 (.flex-1)","display/flex (.flex)","flex-direction/row (.flex-row)","flex-wrap/nowrap (.flex-nowrap)","gap/var(--sf-b0)","justify-content/flex-start (.justify-start)","align-items/center (.items-center)"]}');let s=0;const i=new WeakMap;function r(t,{prefix:e="sf-field",required:n=!1,invalid:r=!1,hint:a="",errorMessage:o=""}={}){const l=function(t,e){if(t&&i.has(t))return i.get(t);const n=(t?.id?String(t.id).trim():"")||`${e}-${++s}`,r={controlId:`${n}-control`,messageId:`${n}-message`};return!t||"object"!=typeof t&&"function"!=typeof t||i.set(t,r),r}(t,e),u=Boolean(r),d=u&&o?o:a;return{...l,required:Boolean(n),invalid:u,message:d,describedBy:d?l.messageId:"",errorMessageId:u&&o?l.messageId:""}}function a(t,e,{prefix:n="sf-field",required:s=!1,invalid:i=!1,messageNode:a=null,labelNode:o=null,errorMessage:l=""}={}){if(!t||!e)return null;const u=r(t,{prefix:n,required:s,invalid:i,hint:a?.textContent?.trim()||"",errorMessage:l});var d,c;return e.id||(e.id=u.controlId),"LABEL"!==t.tagName||t.hasAttribute("for")||t.setAttribute("for",e.id),!o?.textContent?.trim()||e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||(o.id||(o.id=`${e.id}-label`),e.setAttribute("aria-labelledby",o.id)),e.required=u.required,t.classList.toggle("error",u.invalid),e.classList.toggle("error",u.invalid),u.invalid?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid"),a&&(a.id||(a.id=u.messageId),e.setAttribute("aria-describedby",(d=e.getAttribute("aria-describedby"),c=[a.id],[...new Set([...String(d||"").split(/\s+/).filter(Boolean),...c.filter(Boolean)])].join(" ")))),u.errorMessageId&&a?e.setAttribute("aria-errormessage",a.id):e.removeAttribute("aria-errormessage"),u}function o(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function l({component:t="",kind:e="attribute",attribute:n="",from:s,to:i=null}={}){if(!s)return;const r=[t,e,n,s].join("|"),a=o(),l=a.get(r);if(l)l.count+=1;else if(a.set(r,{component:t,kind:e,attribute:n,from:s,to:i,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const r=t?`${t}: `:"",a="value"===e?`${n}="${s}"`:`${e} ${s}`;globalThis.console?.warn?.(`[Simai Framework] ${r}${a} is a legacy name${i?`; write ${i}`:""}. See contracts/changes/journal.json.`)}}if("undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...o().values()].map(t=>({...t}))},t.clear=function(){o().clear()},t.note=l,globalThis.SF.deprecations=t}const u=Object.freeze(["1/2","1","2"]),d=Object.freeze({"1/3":"1/2",3:"2"}),c=new Set;function f(t,e="field",n="1"){const s=String(t??"").trim().toLowerCase();if(u.includes(s))return s;if(Object.hasOwn(d,s)){const t=d[s];l({component:e,kind:"value",attribute:"size",from:s,to:t});const n=`${e}:${s}`;return c.has(n)||"undefined"==typeof console||(c.add(n),console.warn(`[Simai Framework] ${e}: size ${s} is retired for form fields; rendering size ${t}.`)),t}return n}const p=new WeakMap,m=new WeakSet;let h=null;const w="label.sf-input",g="sfInputBound",y=new Set(["text","email","password","search","tel","url"]),x=new Set(["","none","text","tel","url","email","numeric","decimal","search"]),b=new Set(["bordered","filled","hidden"]);function S(t){if(""===t||null==t)return null;const e=Number(t);return Number.isInteger(e)&&e>=0?e:null}function L(t,e=!1){return null==t||""===t?e:"boolean"==typeof t?t:["1","true","yes","on"].includes(String(t).toLowerCase())}function v(t){return t?.querySelector?.(".sf-input-field input, input")||null}function _(t){return t?.querySelector?.(".sf-input-hint-text-wrap")||null}function k(t){const e=_(t);return{messageNode:e,errorMessage:"error"===e?.dataset.fieldMessage&&e.textContent?.trim()||""}}function I(t){if(!t||"string"!=typeof t)return null;const e=t.trim();if(!e)return null;try{const t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch{return null}}function E(t,e,n){const s={...t},i=n.dataset.maskLazy??e.dataset.maskLazy,r=n.dataset.maskPlaceholderChar??e.dataset.maskPlaceholderChar;return void 0!==i&&""!==i&&(s.lazy=L(i,!0)),void 0!==r&&""!==r&&(s.placeholderChar=String(r)),s}async function M(t,e){const n=function(t,e){if(!L(e.dataset.mask??t.dataset.mask,!1))return null;const n=I(e.dataset.maskOptions),s=I(t.dataset.maskOptions);if(n)return E(n,t,e);if(s)return E(s,t,e);const i=e.dataset.maskPattern??t.dataset.maskPattern;return i?E({mask:String(i)},t,e):null}(t,e);if(!n)return;const s={};t.__sfInputMaskRequest=s;try{const i=await function(){const t=()=>window.SF?.Mask?.create?window.SF.Mask:null,e=t();return e?Promise.resolve(e):h||(h=new Promise(e=>{const n=[[window,"sf-mask-ready"],[window,"sf-loader-ready"],[window,"load"],[document,"DOMContentLoaded"]],s=()=>{const i=t();i&&(n.forEach(([t,e])=>t.removeEventListener(e,s)),h=null,e(i))};n.forEach(([t,e])=>t.addEventListener(e,s))}),h)}();if(t.__sfInputMaskRequest!==s)return;const r=await i.create(e,n);if(!r)return;if("1"!==t.dataset[g]||t.__sfInputMaskRequest!==s||v(t)!==e)return void i.destroy(r);t.__sfInputMask=r}catch(t){console.warn("SF.Input mask init failed",t)}}function N(t){if(function(t,e){if(t?.classList)for(const[n,s]of Object.entries(d)){const s=`${e}--size-${n}`;t.classList.contains(s)&&t.classList.replace(s,`${e}--size-${f(n,e)}`)}}(t,"sf-input"),!t||"1"===t.dataset[g])return;const e=v(t);if(!e)return;const n=()=>{},s=()=>t.classList.add("sf-input--pointer-focus"),i=()=>t.classList.remove("sf-input--pointer-focus");e.addEventListener("input",n),e.addEventListener("pointerdown",s),e.addEventListener("blur",i),t.__sfInputNoopHandler=n,t.__sfInputPointerFocusHandler=s,t.__sfInputBlurHandler=i,t.dataset[g]="1";const r=k(t);a(t,e,{prefix:"sf-input",labelNode:t.querySelector(".sf-input-text"),required:e.required||Boolean(t.querySelector(".sf-input-required")),invalid:t.classList.contains("error")||e.classList.contains("error"),...r}),t.__sfInputReleaseReset=function(t,e){const n=t.ownerDocument;m.has(n)||(n.addEventListener("reset",t=>{const e=t.target;if("FORM"!==e?.tagName)return;const n=Array.from(e.elements);setTimeout(()=>{if(!t.defaultPrevented)for(const t of n)if(t.isConnected&&t.form===e)for(const e of p.get(t)||[])e()},0)},!0),m.add(n));let s=p.get(t);return s||p.set(t,s=new Set),s.add(e),()=>s.delete(e)}(e,()=>{t.__sfInputMask&&(t.__sfInputMask.value=e.value)}),M(t,e)}function C(t=document){t.querySelectorAll(w).forEach(N)}class j extends t{static componentName="Inputs";html=null;constructor(t){super(t);const{size:e="1",type:n="bordered",label:s="",required:i=!1,placeholder:r="",inputType:a="text",autocomplete:o="",inputMode:l="",minLength:u="",maxLength:d="",pattern:c="",hint:p="",value:m="",name:h="",leftIcon:w="",rightText:g="",hintIcon:v="",disabled:_=!1,readonly:k=!1,error:I=!1,invalid:E=!1,errorMessage:M="",mask:N=!1,maskPattern:C="",maskLazy:j="",maskPlaceholderChar:O="",maskOptions:$=""}=this.params||{},F=this.attrs.class||this.attrs.className,P=f(e,"sf-input"),q=function(t,e,n){const s=String(t||n);return e.has(s)?s:n}(n,b,"bordered");this.template=document.createElement("label"),this.id&&(this.template.id=this.id),this.template.classList.add("sf-input",`sf-input--size-${P}`,`sf-input--${q}`),this.template.classList.toggle("error",L(E||I,!1)),this.template.dataset.mask=String(L(N,!1)),this.template.dataset.maskPattern=String(C||""),this.template.dataset.maskLazy=String(j??""),this.template.dataset.maskPlaceholderChar=String(O||""),this.template.dataset.maskOptions=String($||""),F&&this.template.classList.add(...`${F}`.split(" ").filter(Boolean));const A=document.createElement("span");A.classList.add("sf-input-label");const T=document.createElement("span");if(T.classList.add("sf-input-text"),T.textContent=s,A.append(T),L(i,!0)){const t=document.createElement("span");t.classList.add("sf-input-required"),t.textContent="*",A.append(t)}const z=document.createElement("span");if(z.classList.add("sf-input-field"),w){const t=document.createElement("i");t.classList.add("sf-icon"),t.textContent=String(w),z.append(t)}const B=document.createElement("input");B.type=function(t){const e=String(t||"text").toLowerCase();return y.has(e)?e:"text"}(a),B.placeholder=String(r??""),o&&(B.autocomplete=String(o)),B.inputMode=function(t){const e=String(t||"").toLowerCase();return x.has(e)?e:""}(l);const H=S(u),R=S(d);if(null!==H&&(B.minLength=H),null!==R&&(B.maxLength=R),c&&(B.pattern=String(c)),B.value=String(m??""),B.defaultValue=String(m??""),h&&(B.name=String(h)),B.disabled=L(_,!1),B.readOnly=L(k,!1),B.required=L(i,!0),B.dataset.mask=String(L(N,!1)),B.dataset.maskPattern=String(C||""),B.dataset.maskLazy=String(j??""),B.dataset.maskPlaceholderChar=String(O||""),B.dataset.maskOptions=String($||""),B.classList.toggle("error",L(E||I,!1)),z.append(B),g){const t=document.createElement("span");t.classList.add("sf-input-right"),t.textContent=String(g),z.append(t)}if(v){const t=document.createElement("i");t.classList.add("sf-icon","sf-icon-hint"),t.textContent=String(v),z.append(t)}this.template.append(A,z);const U=L(E||I,!1)&&M?M:p;if(U){const t=document.createElement("span");t.classList.add("sf-input-hint-text-wrap"),t.textContent=String(U),t.dataset.fieldMessage=L(E||I,!1)&&M?"error":"hint",this.template.append(t)}this.applyLayoutUtilities(this.template,".sf-input"),this.applyLayoutUtilities(A,".sf-input .sf-input-label"),this.applyLayoutUtilities(z,".sf-input .sf-input-field"),this.applyLayoutUtilities(B,".sf-input .sf-input-field input")}init(){N(this.template)}destroyInternal(){!function(t){if(!t||"1"!==t.dataset[g])return;delete t.__sfInputMaskRequest;const e=v(t);e&&t.__sfInputNoopHandler&&e.removeEventListener("input",t.__sfInputNoopHandler),e&&t.__sfInputPointerFocusHandler&&e.removeEventListener("pointerdown",t.__sfInputPointerFocusHandler),e&&t.__sfInputBlurHandler&&e.removeEventListener("blur",t.__sfInputBlurHandler),t.__sfInputMask&&window.SF?.Mask?.destroy?.(t.__sfInputMask),t.__sfInputReleaseReset?.(),delete t.__sfInputReleaseReset,delete t.__sfInputMask,delete t.__sfInputNoopHandler,delete t.__sfInputPointerFocusHandler,delete t.__sfInputBlurHandler,t.classList.remove("sf-input--pointer-focus"),delete t.dataset[g]}(this.template)}}j.utilityMap=n,e("Inputs",j),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.Input=window.SF.Input||{},window.SF.Input.setState=function(t,e={}){const n=t instanceof HTMLElement?t.closest(w)||t:null;if(!n)return!1;const s=v(n);if(!s)return!1;if(Object.prototype.hasOwnProperty.call(e,"disabled")&&(s.disabled=L(e.disabled)),Object.prototype.hasOwnProperty.call(e,"error")){const t=L(e.error);n.classList.toggle("error",t),s.classList.toggle("error",t)}if(Object.prototype.hasOwnProperty.call(e,"invalid")){const t=L(e.invalid);n.classList.toggle("error",t),s.classList.toggle("error",t)}if(Object.prototype.hasOwnProperty.call(e,"errorMessage")){const t=String(e.errorMessage??""),i=t?function(t){const e=_(t);if(e)return e;const n=document.createElement("span");return n.classList.add("sf-input-hint-text-wrap"),t.append(n),n}(n):_(n);if(i){i.textContent=t;const e=n.classList.contains("error")||s.classList.contains("error");i.dataset.fieldMessage=t&&e?"error":"hint"}}return Object.prototype.hasOwnProperty.call(e,"value")&&(s.value=String(e.value??""),s.dispatchEvent(new Event("input",{bubbles:!0}))),a(n,s,{prefix:"sf-input",labelNode:n.querySelector(".sf-input-text"),required:s.required||Boolean(n.querySelector(".sf-input-required")),invalid:n.classList.contains("error")||s.classList.contains("error"),...k(n)}),!0}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>C()):C();new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t instanceof Element&&(t.matches?.(w)&&N(t),C(t))})})}).observe(document.documentElement,{childList:!0,subtree:!0})})();
1
+ (()=>{"use strict";class t{lifecycleName(){return this.componentName??this.constructor.componentName}constructor(t){this.props=t,this.id=t?.id,this.params=t?.param,this.attrs=t?.attrs||{},this.template=null,window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:beforeRender`,{detail:this}))}getUtilityMap(){return this.constructor.utilityMap||null}extractUtilityClasses(t){if(!Array.isArray(t))return[];const e=new Set;return t.forEach(t=>{if("string"!=typeof t)return;const n=t.match(/\(([^)]+)\)/g);n&&n.forEach(t=>{t.slice(1,-1).split(/\s+/).filter(Boolean).forEach(t=>{t.startsWith(".")&&t.length>1&&e.add(t.slice(1))})})}),Array.from(e)}applyLayoutUtilities(t,e){if(!t||!e)return;const n=this.getUtilityMap();if(!n||!n[e])return;this.extractUtilityClasses(n[e]).forEach(e=>t.classList.add(e))}render(){return this.html=this.template,"function"==typeof this.init&&this.init(),this.html&&window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:render`,{detail:this})),this.html}destroy(){this.destroyInternal?.(),this.props=null,this.id=null,this.params=null,this.template=null,this.html&&(this.html.remove(),this.html=null),window.dispatchEvent(new CustomEvent(`${this.lifecycleName()}:destroy`,{detail:this}))}destroyInternal(){}}const e=function(t,e){if(t&&e)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(t,e);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([t,e])}}else window.registerSfComponent(t,e)},n=JSON.parse('{".sf-input":["display/flex (.flex)","flex-direction/column (.flex-col)","flex-wrap/nowrap (.flex-nowrap)","gap/var(--sf-space-1\\\\/4)","justify-content/flex-start (.justify-start)"],".sf-input .sf-input-field":["display/flex (.flex)","flex-direction/row (.flex-row)","flex-wrap/nowrap (.flex-nowrap)","justify-content/flex-start (.justify-start)","align-items/center (.items-center)"],".sf-input .sf-input-label":["display/flex (.flex)","flex-direction/row (.flex-row)","align-items/flex-start (.items-start)"],".sf-input .sf-input-field input":["flex/1 (.flex-1)"],".sf-input .sf-input-field .sf-icon":["display/flex (.flex)","justify-content/flex-start (.justify-start)","align-items/center (.items-center)"],".sf-input .sf-input-text-container":["flex/1 (.flex-1)","display/flex (.flex)","flex-direction/row (.flex-row)","flex-wrap/nowrap (.flex-nowrap)","justify-content/flex-start (.justify-start)","align-items/center (.items-center)"],".sf-input .sf-input-group":["display/flex (.flex)","flex-direction/column (.flex-col)","flex-wrap/nowrap (.flex-nowrap)","justify-content/center (.justify-center)","align-items/flex-start (.items-start)"],".sf-input .sf-input-text-container-alt":["display/flex (.flex)","flex-direction/row (.flex-row)","flex-wrap/nowrap (.flex-nowrap)","justify-content/center (.justify-center)","align-items/center (.items-center)"],".sf-input .sf-icon-alt":["display/flex (.flex)","justify-content/flex-start (.justify-start)","align-items/center (.items-center)"],".sf-input .sf-input-hint-text-wrap":["flex/1 (.flex-1)","display/flex (.flex)","flex-direction/row (.flex-row)","flex-wrap/nowrap (.flex-nowrap)","gap/var(--sf-b0)","justify-content/flex-start (.justify-start)","align-items/center (.items-center)"]}');let s=0;const i=new WeakMap;function r(t,{prefix:e="sf-field",required:n=!1,invalid:r=!1,hint:a="",errorMessage:o=""}={}){const l=function(t,e){if(t&&i.has(t))return i.get(t);const n=(t?.id?String(t.id).trim():"")||`${e}-${++s}`,r={controlId:`${n}-control`,messageId:`${n}-message`};return!t||"object"!=typeof t&&"function"!=typeof t||i.set(t,r),r}(t,e),u=Boolean(r),d=u&&o?o:a;return{...l,required:Boolean(n),invalid:u,message:d,describedBy:d?l.messageId:"",errorMessageId:u&&o?l.messageId:""}}function a(t,e,{prefix:n="sf-field",required:s=!1,invalid:i=!1,messageNode:a=null,labelNode:o=null,errorMessage:l=""}={}){if(!t||!e)return null;const u=r(t,{prefix:n,required:s,invalid:i,hint:a?.textContent?.trim()||"",errorMessage:l});var d,c;return e.id||(e.id=u.controlId),"LABEL"!==t.tagName||t.hasAttribute("for")||t.setAttribute("for",e.id),!o?.textContent?.trim()||e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||(o.id||(o.id=`${e.id}-label`),e.setAttribute("aria-labelledby",o.id)),e.required=u.required,t.classList.toggle("error",u.invalid),e.classList.toggle("error",u.invalid),u.invalid?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid"),a&&(a.id||(a.id=u.messageId),e.setAttribute("aria-describedby",(d=e.getAttribute("aria-describedby"),c=[a.id],[...new Set([...String(d||"").split(/\s+/).filter(Boolean),...c.filter(Boolean)])].join(" ")))),u.errorMessageId&&a?e.setAttribute("aria-errormessage",a.id):e.removeAttribute("aria-errormessage"),u}function o(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function l({component:t="",kind:e="attribute",attribute:n="",from:s,to:i=null}={}){if(!s)return;const r=[t,e,n,s].join("|"),a=o(),l=a.get(r);if(l)l.count+=1;else if(a.set(r,{component:t,kind:e,attribute:n,from:s,to:i,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const r=t?`${t}: `:"",a="value"===e?`${n}="${s}"`:`${e} ${s}`;globalThis.console?.warn?.(`[SIMAI Framework] ${r}${a} is a legacy name${i?`; write ${i}`:""}. See contracts/changes/journal.json.`)}}if("undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...o().values()].map(t=>({...t}))},t.clear=function(){o().clear()},t.note=l,globalThis.SF.deprecations=t}const u=Object.freeze(["1/2","1","2"]),d=Object.freeze({"1/3":"1/2",3:"2"}),c=new Set;function f(t,e="field",n="1"){const s=String(t??"").trim().toLowerCase();if(u.includes(s))return s;if(Object.hasOwn(d,s)){const t=d[s];l({component:e,kind:"value",attribute:"size",from:s,to:t});const n=`${e}:${s}`;return c.has(n)||"undefined"==typeof console||(c.add(n),console.warn(`[SIMAI Framework] ${e}: size ${s} is retired for form fields; rendering size ${t}.`)),t}return n}const p=new WeakMap,m=new WeakSet;let h=null;const w="label.sf-input",g="sfInputBound",y=new Set(["text","email","password","search","tel","url"]),x=new Set(["","none","text","tel","url","email","numeric","decimal","search"]),b=new Set(["bordered","filled","hidden"]);function S(t){if(""===t||null==t)return null;const e=Number(t);return Number.isInteger(e)&&e>=0?e:null}function L(t,e=!1){return null==t||""===t?e:"boolean"==typeof t?t:["1","true","yes","on"].includes(String(t).toLowerCase())}function v(t){return t?.querySelector?.(".sf-input-field input, input")||null}function _(t){return t?.querySelector?.(".sf-input-hint-text-wrap")||null}function I(t){const e=_(t);return{messageNode:e,errorMessage:"error"===e?.dataset.fieldMessage&&e.textContent?.trim()||""}}function k(t){if(!t||"string"!=typeof t)return null;const e=t.trim();if(!e)return null;try{const t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch{return null}}function E(t,e,n){const s={...t},i=n.dataset.maskLazy??e.dataset.maskLazy,r=n.dataset.maskPlaceholderChar??e.dataset.maskPlaceholderChar;return void 0!==i&&""!==i&&(s.lazy=L(i,!0)),void 0!==r&&""!==r&&(s.placeholderChar=String(r)),s}async function M(t,e){const n=function(t,e){if(!L(e.dataset.mask??t.dataset.mask,!1))return null;const n=k(e.dataset.maskOptions),s=k(t.dataset.maskOptions);if(n)return E(n,t,e);if(s)return E(s,t,e);const i=e.dataset.maskPattern??t.dataset.maskPattern;return i?E({mask:String(i)},t,e):null}(t,e);if(!n)return;const s={};t.__sfInputMaskRequest=s;try{const i=await function(){const t=()=>window.SF?.Mask?.create?window.SF.Mask:null,e=t();return e?Promise.resolve(e):h||(h=new Promise(e=>{const n=[[window,"sf-mask-ready"],[window,"sf-loader-ready"],[window,"load"],[document,"DOMContentLoaded"]],s=()=>{const i=t();i&&(n.forEach(([t,e])=>t.removeEventListener(e,s)),h=null,e(i))};n.forEach(([t,e])=>t.addEventListener(e,s))}),h)}();if(t.__sfInputMaskRequest!==s)return;const r=await i.create(e,n);if(!r)return;if("1"!==t.dataset[g]||t.__sfInputMaskRequest!==s||v(t)!==e)return void i.destroy(r);t.__sfInputMask=r}catch(t){console.warn("SF.Input mask init failed",t)}}function N(t){if(function(t,e){if(t?.classList)for(const[n,s]of Object.entries(d)){const s=`${e}--size-${n}`;t.classList.contains(s)&&t.classList.replace(s,`${e}--size-${f(n,e)}`)}}(t,"sf-input"),!t||"1"===t.dataset[g])return;const e=v(t);if(!e)return;const n=()=>{},s=()=>t.classList.add("sf-input--pointer-focus"),i=()=>t.classList.remove("sf-input--pointer-focus");e.addEventListener("input",n),e.addEventListener("pointerdown",s),e.addEventListener("blur",i),t.__sfInputNoopHandler=n,t.__sfInputPointerFocusHandler=s,t.__sfInputBlurHandler=i,t.dataset[g]="1";const r=I(t);a(t,e,{prefix:"sf-input",labelNode:t.querySelector(".sf-input-text"),required:e.required||Boolean(t.querySelector(".sf-input-required")),invalid:t.classList.contains("error")||e.classList.contains("error"),...r}),t.__sfInputReleaseReset=function(t,e){const n=t.ownerDocument;m.has(n)||(n.addEventListener("reset",t=>{const e=t.target;if("FORM"!==e?.tagName)return;const n=Array.from(e.elements);setTimeout(()=>{if(!t.defaultPrevented)for(const t of n)if(t.isConnected&&t.form===e)for(const e of p.get(t)||[])e()},0)},!0),m.add(n));let s=p.get(t);return s||p.set(t,s=new Set),s.add(e),()=>s.delete(e)}(e,()=>{t.__sfInputMask&&(t.__sfInputMask.value=e.value)}),M(t,e)}function C(t=document){t.querySelectorAll(w).forEach(N)}class j extends t{static componentName="Inputs";html=null;constructor(t){super(t);const{size:e="1",type:n="bordered",label:s="",required:i=!1,placeholder:r="",inputType:a="text",autocomplete:o="",inputMode:l="",minLength:u="",maxLength:d="",pattern:c="",hint:p="",value:m="",name:h="",leftIcon:w="",rightText:g="",hintIcon:v="",disabled:_=!1,readonly:I=!1,error:k=!1,invalid:E=!1,errorMessage:M="",mask:N=!1,maskPattern:C="",maskLazy:j="",maskPlaceholderChar:O="",maskOptions:$=""}=this.params||{},F=this.attrs.class||this.attrs.className,P=f(e,"sf-input"),q=function(t,e,n){const s=String(t||n);return e.has(s)?s:n}(n,b,"bordered");this.template=document.createElement("label"),this.id&&(this.template.id=this.id),this.template.classList.add("sf-input",`sf-input--size-${P}`,`sf-input--${q}`),this.template.classList.toggle("error",L(E||k,!1)),this.template.dataset.mask=String(L(N,!1)),this.template.dataset.maskPattern=String(C||""),this.template.dataset.maskLazy=String(j??""),this.template.dataset.maskPlaceholderChar=String(O||""),this.template.dataset.maskOptions=String($||""),F&&this.template.classList.add(...`${F}`.split(" ").filter(Boolean));const A=document.createElement("span");A.classList.add("sf-input-label");const T=document.createElement("span");if(T.classList.add("sf-input-text"),T.textContent=s,A.append(T),L(i,!0)){const t=document.createElement("span");t.classList.add("sf-input-required"),t.textContent="*",A.append(t)}const z=document.createElement("span");if(z.classList.add("sf-input-field"),w){const t=document.createElement("i");t.classList.add("sf-icon"),t.textContent=String(w),z.append(t)}const B=document.createElement("input");B.type=function(t){const e=String(t||"text").toLowerCase();return y.has(e)?e:"text"}(a),B.placeholder=String(r??""),o&&(B.autocomplete=String(o)),B.inputMode=function(t){const e=String(t||"").toLowerCase();return x.has(e)?e:""}(l);const H=S(u),R=S(d);if(null!==H&&(B.minLength=H),null!==R&&(B.maxLength=R),c&&(B.pattern=String(c)),B.value=String(m??""),B.defaultValue=String(m??""),h&&(B.name=String(h)),B.disabled=L(_,!1),B.readOnly=L(I,!1),B.required=L(i,!0),B.dataset.mask=String(L(N,!1)),B.dataset.maskPattern=String(C||""),B.dataset.maskLazy=String(j??""),B.dataset.maskPlaceholderChar=String(O||""),B.dataset.maskOptions=String($||""),B.classList.toggle("error",L(E||k,!1)),z.append(B),g){const t=document.createElement("span");t.classList.add("sf-input-right"),t.textContent=String(g),z.append(t)}if(v){const t=document.createElement("i");t.classList.add("sf-icon","sf-icon-hint"),t.textContent=String(v),z.append(t)}this.template.append(A,z);const U=L(E||k,!1)&&M?M:p;if(U){const t=document.createElement("span");t.classList.add("sf-input-hint-text-wrap"),t.textContent=String(U),t.dataset.fieldMessage=L(E||k,!1)&&M?"error":"hint",this.template.append(t)}this.applyLayoutUtilities(this.template,".sf-input"),this.applyLayoutUtilities(A,".sf-input .sf-input-label"),this.applyLayoutUtilities(z,".sf-input .sf-input-field"),this.applyLayoutUtilities(B,".sf-input .sf-input-field input")}init(){N(this.template)}destroyInternal(){!function(t){if(!t||"1"!==t.dataset[g])return;delete t.__sfInputMaskRequest;const e=v(t);e&&t.__sfInputNoopHandler&&e.removeEventListener("input",t.__sfInputNoopHandler),e&&t.__sfInputPointerFocusHandler&&e.removeEventListener("pointerdown",t.__sfInputPointerFocusHandler),e&&t.__sfInputBlurHandler&&e.removeEventListener("blur",t.__sfInputBlurHandler),t.__sfInputMask&&window.SF?.Mask?.destroy?.(t.__sfInputMask),t.__sfInputReleaseReset?.(),delete t.__sfInputReleaseReset,delete t.__sfInputMask,delete t.__sfInputNoopHandler,delete t.__sfInputPointerFocusHandler,delete t.__sfInputBlurHandler,t.classList.remove("sf-input--pointer-focus"),delete t.dataset[g]}(this.template)}}j.utilityMap=n,e("Inputs",j),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.Input=window.SF.Input||{},window.SF.Input.setState=function(t,e={}){const n=t instanceof HTMLElement?t.closest(w)||t:null;if(!n)return!1;const s=v(n);if(!s)return!1;if(Object.prototype.hasOwnProperty.call(e,"disabled")&&(s.disabled=L(e.disabled)),Object.prototype.hasOwnProperty.call(e,"error")){const t=L(e.error);n.classList.toggle("error",t),s.classList.toggle("error",t)}if(Object.prototype.hasOwnProperty.call(e,"invalid")){const t=L(e.invalid);n.classList.toggle("error",t),s.classList.toggle("error",t)}if(Object.prototype.hasOwnProperty.call(e,"errorMessage")){const t=String(e.errorMessage??""),i=t?function(t){const e=_(t);if(e)return e;const n=document.createElement("span");return n.classList.add("sf-input-hint-text-wrap"),t.append(n),n}(n):_(n);if(i){i.textContent=t;const e=n.classList.contains("error")||s.classList.contains("error");i.dataset.fieldMessage=t&&e?"error":"hint"}}return Object.prototype.hasOwnProperty.call(e,"value")&&(s.value=String(e.value??""),s.dispatchEvent(new Event("input",{bubbles:!0}))),a(n,s,{prefix:"sf-input",labelNode:n.querySelector(".sf-input-text"),required:s.required||Boolean(n.querySelector(".sf-input-required")),invalid:n.classList.contains("error")||s.classList.contains("error"),...I(n)}),!0}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>C()):C();new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{t instanceof Element&&(t.matches?.(w)&&N(t),C(t))})})}).observe(document.documentElement,{childList:!0,subtree:!0})})();