@simai-studio/ui 5.20261022.1303 → 5.20261022.1534

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 (31) 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/sf-system/js/sf-system.min.js +1 -1
  5. package/distr/component/textarea/css/textarea.min.css +1 -1
  6. package/distr/component/textarea/js/textarea.min.js +1 -1
  7. package/distr/core/contracts/public-js-api.json +7 -2
  8. package/distr/core/js/core-loader.js +1 -1
  9. package/distr/core/js/core-loader.min.js +1 -1
  10. package/distr/core/js/core-system.js +8 -28
  11. package/distr/core/js/core-system.min.js +1 -1
  12. package/distr/core/js/core.js +131 -9
  13. package/distr/core/js/core.min.js +2 -2
  14. package/distr/core/js/template-utilities.generated.json +1 -0
  15. package/distr/smart/context-menu/js/context-menu.min.js +1 -1
  16. package/distr/smart/context-menu/smart.manifest.json +1 -1
  17. package/distr/smart/country-code/js/country-code.min.js +1 -1
  18. package/distr/smart/datepicker/js/datepicker.min.js +8 -8
  19. package/distr/smart/datepicker/smart.manifest.json +2 -2
  20. package/distr/smart/dropdown/js/dropdown.min.js +19 -19
  21. package/distr/smart/help-mark/js/help-mark.min.js +3 -3
  22. package/distr/smart/help-mark/smart.manifest.json +1 -1
  23. package/distr/smart/popover/js/popover.min.js +1 -1
  24. package/distr/smart/popover/smart.manifest.json +1 -1
  25. package/distr/smart/profile-picker/js/profile-picker.min.js +2 -2
  26. package/distr/smart/profile-picker/smart.manifest.json +1 -1
  27. package/distr/smart/textarea/js/textarea.min.js +26 -23
  28. package/distr/smart/textarea/smart.manifest.json +21 -2
  29. package/distr/smart/textarea/template/default.js +8 -1
  30. package/package-manifest.json +31 -31
  31. package/package.json +4 -4
@@ -367,6 +367,7 @@
367
367
  "cl-textarea": [
368
368
  "display/default",
369
369
  "flex-direction/default",
370
+ "isolate/default",
370
371
  "position/default",
371
372
  "transition-property/default"
372
373
  ],
@@ -1,4 +1,4 @@
1
- (()=>{"use strict";var e={"765b8f3f8ccb"(e,t,n){n.a(e,async(e,t)=>{try{var s=n("fbe0570fcc69"),i=n("5c1dc214bb5e"),r=n("1197ac823db7"),o=n("0d662e4d7d63"),a=e([s,i,r,o]);[s,i,r,o]=a.then?(await a)():a;var l=n.n(s),c=n.n(i);const u={en:{close:"Close"},ru:{close:"Закрыть"}},h=()=>globalThis.SF?.Position||c(),d=500,m={start:"inline-start",end:"inline-end","top-start":"top-inline-start","top-end":"top-inline-end","bottom-start":"bottom-inline-start","bottom-end":"bottom-inline-end","left-start":"left-top","left-end":"left-bottom","right-start":"right-top","right-end":"right-bottom","inline-start-start":"inline-start-top","inline-start-end":"inline-start-bottom","inline-end-start":"inline-end-top","inline-end-end":"inline-end-bottom"};function p(e=""){const t=String(e||"").trim().toLowerCase();return m[t]||t}class f extends(l()){constructor(){if(super(),this._itemAttributes=new Map,this._currentItem=null,this._itemObserver=new MutationObserver(()=>this.syncMenuItems()),this.addEventListener("keydown",this.handleMenuKeyDown),this.addEventListener("keydown",this.handleOwnedKeyDown),this.addEventListener("click",this.handleEntryClick),this.addEventListener("pointerover",this.handleEntryHover),this._owned=null,this._typeahead={text:"",at:0},Object.prototype.hasOwnProperty.call(this,"search")){const e=this.search;delete this.search,this._search=e&&"object"==typeof e?e:null}if(Object.prototype.hasOwnProperty.call(this,"entries")){const e=this.entries;delete this.entries,this._entries=Array.isArray(e)?e:null}this._onOutsidePress=e=>{const t=e.composedPath();t.includes(this)||t.includes(this._owned?.anchor)||this._submenu&&t.includes(this._submenu)||this.close({restoreFocus:!1})},this.addEventListener("focusin",e=>{this.menuItems().includes(e.target)&&(this._currentItem=e.target,this.syncMenuItems())}),this.addEventListener("sf-after-render",e=>{e.target!==this&&e.target.closest("sf-context-menu")===this&&this.syncMenuItems()})}afterRender(e){if("function"==typeof e)return super.afterRender(e);this._itemObserver.disconnect(),this.syncMenuItems();const t=this.querySelector(".sf-context-menu-content");t&&this._itemObserver.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled","aria-disabled","hidden","inert"]})}disconnectedCallback(){this._owned&&this.close({restoreFocus:!1}),this._itemObserver.disconnect();for(const e of this._itemAttributes.keys())this.releaseItem(e);this._currentItem=null,super.disconnectedCallback()}menuItems(){if("default"!==this.templateName||"menu"!==this.role)return[];const e=this.querySelector(".sf-context-menu-content");return this.entries.length?Array.from(e?.querySelectorAll(".sf-context-menu-item")||[]):Array.from(e?.children||[]).flatMap(e=>{const t="sf-button"===e.localName?e.querySelector("button, a[href]"):e;if(!t?.matches("button, a[href]"))return[];const n=t.getAttribute("role");return n&&"menuitem"!==n?[]:[t]})}availableMenuItems(){return this.menuItems().filter(e=>!e.matches(":disabled")&&!e.closest('[hidden], [inert], [aria-disabled="true"], sf-button[disabled]')&&e.getClientRects().length>0&&"hidden"!==getComputedStyle(e).visibility)}ownItemAttribute(e,t,n){let s=this._itemAttributes.get(e);s||this._itemAttributes.set(e,s=new Map);let i=s.get(t);i||(i={original:e.getAttribute(t),value:e.getAttribute(t),released:!1},s.set(t,i)),i.released||e.getAttribute(t)!==i.value?i.released=!0:(i.value!==n&&e.setAttribute(t,n),i.value=n)}releaseItem(e){for(const[t,n]of this._itemAttributes.get(e)||[])n.released||e.getAttribute(t)!==n.value||(null===n.original?e.removeAttribute(t):e.setAttribute(t,n.original));this._itemAttributes.delete(e)}syncMenuItems(){const e=this.menuItems(),t=this.availableMenuItems();for(const t of this._itemAttributes.keys())e.includes(t)||this.releaseItem(t);t.includes(this._currentItem)||(this._currentItem=t[0]||null);for(const t of e)t.classList.contains("sf-context-menu-item")||this.ownItemAttribute(t,"role","menuitem"),this.ownItemAttribute(t,"tabindex",t===this._currentItem?"0":"-1")}focus(e){this.syncMenuItems(),this._currentItem?.focus(e)}get entries(){if(Array.isArray(this._entries))return this._entries;if(!this.hasAttribute("entries"))return[];try{const e=JSON.parse(this.getAttribute("entries"));return Array.isArray(e)?e:[]}catch{return[]}}set entries(e){this._entries=Array.isArray(e)?e:null,this.requestComponentUpdate("entries")}entryOf(e){const t=e?.closest?.(".sf-context-menu-item");return t&&this.contains(t)?this.entries[Number(t.dataset.sfEntry)]??null:null}get search(){return this._search&&"object"==typeof this._search?this._search:null}set search(e){this._search=e&&"object"==typeof e?e:null,this.requestComponentUpdate("search")}get query(){return this._query??""}setQuery(e){this._query=String(e??""),this.requestComponentUpdate("query"),this.search?.remote&&this.dispatchEvent(new CustomEvent("sf-context-menu-search",{bubbles:!0,composed:!0,detail:{query:this._query}}))}searchField(){return this.querySelector(".sf-context-menu-search-input")}chooseOption(e,t){const n=Number(e.dataset.sfOption),s=t.options?.[n];if(!s||s.disabled)return;if(!this.dispatchEvent(new CustomEvent("sf-context-menu-select",{bubbles:!0,composed:!0,cancelable:!0,detail:{id:s.id??null,entry:s,checked:!0,group:t.id??null}})))return;const i=this.entries.indexOf(t),r={...t,options:t.options.map((e,t)=>({...e,checked:t===n}))};this.entries=this.entries.map((e,t)=>t===i?r:e),!1===t.keepOpen&&this.closeAll()}handleEntryClick(e){const t=e.target?.closest?.(".sf-context-menu-item");if(!t||!this.contains(t)||t.matches(":disabled"))return;const n=this.entryOf(t);if(!n)return;if(void 0!==t.dataset.sfOption)return void this.chooseOption(t,n);if(Array.isArray(n.submenu)&&n.submenu.length)return e.preventDefault(),void this.openSubmenu(t,n,{focus:0===e.detail||n.search?"first":"none"});const s="check"===n.kind||"radio"===n.kind,i={id:n.id??null,entry:n,checked:s?"radio"===n.kind||!n.checked:null};this.dispatchEvent(new CustomEvent("sf-context-menu-select",{bubbles:!0,composed:!0,cancelable:!0,detail:i}))&&!n.keepOpen&&this.closeAll({restoreFocus:!n.href})}handleEntryHover(e){if(!this._owned||"touch"===e.pointerType)return;const t=e.target?.closest?.(".sf-context-menu-item");t&&this.contains(t)&&t!==this._hoverRow&&(this._hoverRow=t,clearTimeout(this._hoverTimer),this._hoverTimer=setTimeout(()=>{if(this._hoverRow!==t||!this._owned)return;const e=this.entryOf(t);e&&Array.isArray(e.submenu)&&e.submenu.length&&!t.matches(":disabled")?this.openSubmenu(t,e,{focus:"none"}):this.closeSubmenu({restoreFocus:!1})},120))}toggleFor(e,t={}){return this._owned?.anchor===e?(this.close(),Promise.resolve(!1)):this.openFor(e,t)}get isOpen(){return Boolean(this._owned)}surface(){return this.querySelector(":scope > .sf-context-menu")}async openFor(e,{side:t="block-end",align:n="start",focus:s="first",parentMenu:i=null,alignmentOffset:r=0,width:o=this.width}={}){if(!(e instanceof Element))throw new TypeError("A menu opens for an element");this._owned&&this.close({restoreFocus:!1}),await this.whenRendered();const a=this.surface();if(!a)return!1;const l=document.activeElement;var c;this._owned={anchor:e,parentMenu:i,returnTo:l instanceof HTMLElement&&l!==document.body&&l!==document.documentElement?l:(c=e,c?.matches?.("button, a[href], input, select, textarea, [tabindex]")?c:c?.querySelector?.("button, a[href], input, select, textarea, [tabindex]")??c),expanded:e.getAttribute("aria-expanded"),haspopup:e.getAttribute("aria-haspopup")},e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","true"),a.classList.add("sf-context-menu--open"),"function"==typeof a.showPopover?(a.setAttribute("popover","manual"),a.matches(":popover-open")||a.showPopover()):a.style.zIndex="var(--sf-z-index-9)";const u=this.querySelector(".sf-context-menu-content");if(o&&"content"!==o&&u){const t="trigger"===o?`${e.getBoundingClientRect().width}px`:o;u.style.setProperty("--sf-context-menu--min-inline-size",t),u.style.setProperty("--sf-context-menu--max-inline-size",t),u.style.setProperty("inline-size",t),this._owned.sizedContent=u}if(this._owned.position=h().anchor(e,a,{side:t,align:n,alignmentOffset:r,flip:!0,shift:!0,fitHeight:!0,matchWidth:"trigger"===o}),document.addEventListener("pointerdown",this._onOutsidePress,!0),this.dispatchEvent(new CustomEvent("sf-context-menu-open",{bubbles:!0,composed:!0})),"none"!==s){this.syncMenuItems();const e=this.availableMenuItems(),t=this.searchField();t&&"last"!==s?t.focus({preventScroll:!0}):("last"===s?e[e.length-1]:e[0])?.focus({preventScroll:!0})}return!0}close({restoreFocus:e=!0}={}){const t=this._owned;if(!t)return!1;this.closeSubmenu({restoreFocus:!1}),this._owned=null,this._hoverRow=null,this._query&&(this._query="",this.requestComponentUpdate("query")),clearTimeout(this._hoverTimer),t.position?.stop();for(const e of["--sf-context-menu--min-inline-size","--sf-context-menu--max-inline-size","inline-size"])t.sizedContent?.style.removeProperty(e);document.removeEventListener("pointerdown",this._onOutsidePress,!0);const n=this.surface();n&&(n.matches?.(":popover-open")&&n.hidePopover(),n.removeAttribute("popover"),n.classList.remove("sf-context-menu--open"),n.style.removeProperty("z-index"));const{anchor:s}=t;return null===t.haspopup?s.removeAttribute("aria-haspopup"):s.setAttribute("aria-haspopup",t.haspopup),null===t.expanded?s.setAttribute("aria-expanded","false"):s.setAttribute("aria-expanded",t.expanded),e&&(t.returnTo?.isConnected?t.returnTo:s)?.focus?.({preventScroll:!0}),this.dispatchEvent(new CustomEvent("sf-context-menu-close",{bubbles:!0,composed:!0})),!0}closeAll({restoreFocus:e=!0}={}){let t=this;for(;t._owned?.parentMenu;)t=t._owned.parentMenu;return t===this?this.close({restoreFocus:e}):t.close({restoreFocus:e})}async openSubmenu(e,t,{focus:n="first"}={}){if(this._submenu?._owned?.anchor===e)return"none"!==n&&this._submenu.focus(),this._submenu;this.closeSubmenu({restoreFocus:!1});const s=document.createElement("sf-context-menu");s.setAttribute("aria-label",t.text??""),s.setAttribute("popup",""),"1"===this.size&&s.setAttribute("size","1"),s.entries=t.submenu,t.search&&(s.search=t.search),s.addEventListener("sf-context-menu-select",e=>{e.stopPropagation();this.dispatchEvent(new CustomEvent("sf-context-menu-select",{bubbles:!0,composed:!0,cancelable:!0,detail:e.detail}))||e.preventDefault()}),s.addEventListener("sf-context-menu-close",()=>{this._submenu===s&&(this._submenu=null,s.remove())}),(this.closest("dialog[open]")||document.body).append(s),this._submenu=s;const i=this.querySelector(".sf-context-menu-content"),r=i?getComputedStyle(i):null,o=r?(parseFloat(r.paddingTop)||0)+(parseFloat(r.borderTopWidth)||0):0;return await s.openFor(e,{side:"inline-end",align:"start",focus:n,parentMenu:this,alignmentOffset:-o}),s}closeSubmenu({restoreFocus:e=!0}={}){const t=this._submenu;return!!t&&(this._submenu=null,t.close({restoreFocus:e}),t.remove(),!0)}handleOwnedKeyDown(e){if(!this._owned||e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey)return;if(!this.contains(e.target))return;const t="rtl"===getComputedStyle(this.surface()??document.documentElement).direction,n=t?"ArrowLeft":"ArrowRight",s=t?"ArrowRight":"ArrowLeft",i=e.target?.closest?.(".sf-context-menu-choice-option");if(i&&(e.key===n||e.key===s)){const t=Array.from(i.parentElement.querySelectorAll(".sf-context-menu-choice-option:not(:disabled)")),s=t.indexOf(i),r=t[(s+(e.key===n?1:t.length-1))%t.length];return e.preventDefault(),void r?.focus()}if(e.target===this.searchField()&&"Escape"!==e.key&&"Tab"!==e.key)return void("ArrowDown"===e.key&&(e.preventDefault(),this.syncMenuItems(),this.availableMenuItems()[0]?.focus()));if("Escape"===e.key||e.key===s&&this._owned.parentMenu)return e.preventDefault(),e.stopPropagation(),void this.close();if("Tab"===e.key)return void this.closeAll({restoreFocus:!0});const r=this.entryOf(e.target);if(e.key===n&&r&&Array.isArray(r.submenu)&&r.submenu.length)return e.preventDefault(),void this.openSubmenu(e.target.closest(".sf-context-menu-item"),r,{focus:"first"});1===e.key.length&&" "!==e.key&&this.typeahead(e)}typeahead(e){const t=Date.now();this._typeahead.text=(t-this._typeahead.at>d?"":this._typeahead.text)+e.key.toLowerCase(),this._typeahead.at=t;const n=this.availableMenuItems(),s=Math.max(0,n.indexOf(e.target)),i=[...n.slice(s+(1===this._typeahead.text.length?1:0)),...n.slice(0,s+1)].find(e=>(e.querySelector(".sf-context-menu-item-label")?.textContent??e.textContent).trim().toLowerCase().startsWith(this._typeahead.text));i&&(e.preventDefault(),i.focus())}handleMenuKeyDown(e){if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;const t=this.availableMenuItems(),n=t.indexOf(e.target);if(n<0)return;let s;switch(e.key){case"ArrowDown":s=(n+1)%t.length;break;case"ArrowUp":s=(n+t.length-1)%t.length;break;case"Home":s=0;break;case"End":s=t.length-1;break;default:return}e.preventDefault(),e.stopPropagation(),t[s].focus()}static get props(){return{templateName:{attribute:"template",default:"default"},position:{default:""},tooltip:{type:Boolean,default:!0},text:{default:""},ariaLabel:{default:""},items:{type:Array,default:[]},entries:{type:Array,default:[]},popup:{type:Boolean,default:!1},role:{default:"menu"},contentClass:{default:""},rootClass:{default:""},size:{default:"1/2"},width:{default:"content"},tabs:{default:""},activeTab:{attribute:"active-tab",default:""},closable:{type:Boolean,default:!1}}}get tabs(){const e=Array.isArray(this._tabs)?this._tabs:this.getAttribute("tabs")||"";return(Array.isArray(e)?e:String(e).split("|").map(e=>e.trim()).filter(Boolean)).map((e,t)=>"string"==typeof e?{id:e,label:e,index:t}:{id:String(e.id??t),label:String(e.label??e.id??t),index:t})}set tabs(e){if(Array.isArray(e))return this._tabs=e,void this.requestComponentUpdate("tabs");this._tabs=null,this.setState({tabs:e?String(e):""})}get activeTab(){const e=this.tabs,t=this.getAttribute("active-tab")??"";return e.find(e=>e.id===t)??e[Number(t)]??e[0]??null}get closable(){return this.getBooleanAttr("closable",!1)}get panel(){return this.tabs.length>0}chooseTab(e){const t=this.tabs[e];return t&&t.id!==this.activeTab?.id?(this.setState({activeTab:t.id}),this.dispatchEvent(new CustomEvent("sf-context-menu-tab",{bubbles:!0,composed:!0,detail:{id:t.id,index:t.index}})),this):this}requestClose(){return this._owned?this.close():(this.dispatchEvent(new CustomEvent("sf-context-menu-close",{bubbles:!0,composed:!0})),!0)}get templateName(){return this.getAttribute("template")||"default"}get position(){return p(this.getAttribute("position"))}get tooltip(){return this.getBooleanAttr("tooltip",!0)}get text(){return this.getAttribute("text")||""}get ariaLabel(){return this.getAttribute("aria-label")||""}get role(){return this.getAttribute("role")||"menu"}get size(){return"1"===this.getAttribute("size")?"1":"1/2"}get width(){return this.getAttribute("width")||"content"}get contentClass(){return this.getAttribute("content-class")||""}templateContext(){const e=this.getPropsContext();return this.createTemplateContext({...e,entries:this.entries,search:this.search,query:this.query,tabs:this.tabs,activeTab:this.activeTab,closable:this.closable,closeLabel:(0,o.pageText)(u,"close",this,"sf-context-menu"),panel:this.panel,position:this.position,size:this.size,component:this,rootClass:this.getRootClass()})}template(){return(0,r.x)(this.templateContext())}}f.define("sf-context-menu"),t()}catch(b){t(b)}})},"1197ac823db7"(e,t,n){n.a(e,async(e,s)=>{try{n.d(t,{x:()=>$});var i=n("ddf1cdb42ecc"),r=e([i]),o=r.then?(await r)():r;i=o[0];function a(...e){return e.flat().filter(Boolean).join(" ")}function l(e){if("sf-button"===e?.component){const t=e.props||{},n=t["@click"];return i.html`
1
+ (()=>{"use strict";var e={"421676f72963"(e,t,n){n.d(t,{Ec:()=>a});const s="sfPopoverOpen",i=new WeakSet,r=Symbol.for("sf.openSurfaceLayers");function o(){const e=globalThis;return Array.isArray(e[r])||(e[r]=[]),e[r]}function a(e,t){if(!e)return;const n=Boolean(t);if(n===i.has(e))return;const r=o();if(n)i.add(e),r.push(e);else{i.delete(e);const t=r.lastIndexOf(e);t>=0&&r.splice(t,1)}!function(e){const t=globalThis.document?.documentElement;if(!t)return;const n=Math.max(0,Number(t.dataset[s]||0)+e);n?t.dataset[s]=String(n):delete t.dataset[s]}(n?1:-1)}},"765b8f3f8ccb"(e,t,n){n.a(e,async(e,t)=>{try{var s=n("fbe0570fcc69"),i=n("5c1dc214bb5e"),r=n("1197ac823db7"),o=n("0d662e4d7d63"),a=n("421676f72963"),l=e([s,i,r,o]);[s,i,r,o]=l.then?(await l)():l;var c=n.n(s),u=n.n(i);const h={en:{close:"Close"},ru:{close:"Закрыть"}},d=()=>globalThis.SF?.Position||u(),m=500,p={start:"inline-start",end:"inline-end","top-start":"top-inline-start","top-end":"top-inline-end","bottom-start":"bottom-inline-start","bottom-end":"bottom-inline-end","left-start":"left-top","left-end":"left-bottom","right-start":"right-top","right-end":"right-bottom","inline-start-start":"inline-start-top","inline-start-end":"inline-start-bottom","inline-end-start":"inline-end-top","inline-end-end":"inline-end-bottom"};function f(e=""){const t=String(e||"").trim().toLowerCase();return p[t]||t}class b extends(c()){constructor(){if(super(),this._itemAttributes=new Map,this._currentItem=null,this._itemObserver=new MutationObserver(()=>this.syncMenuItems()),this.addEventListener("keydown",this.handleMenuKeyDown),this.addEventListener("keydown",this.handleOwnedKeyDown),this.addEventListener("click",this.handleEntryClick),this.addEventListener("pointerover",this.handleEntryHover),this._owned=null,this._typeahead={text:"",at:0},Object.prototype.hasOwnProperty.call(this,"search")){const e=this.search;delete this.search,this._search=e&&"object"==typeof e?e:null}if(Object.prototype.hasOwnProperty.call(this,"entries")){const e=this.entries;delete this.entries,this._entries=Array.isArray(e)?e:null}this._onOutsidePress=e=>{const t=e.composedPath();t.includes(this)||t.includes(this._owned?.anchor)||this._submenu&&t.includes(this._submenu)||this.close({restoreFocus:!1})},this.addEventListener("focusin",e=>{this.menuItems().includes(e.target)&&(this._currentItem=e.target,this.syncMenuItems())}),this.addEventListener("sf-after-render",e=>{e.target!==this&&e.target.closest("sf-context-menu")===this&&this.syncMenuItems()})}afterRender(e){if("function"==typeof e)return super.afterRender(e);this._itemObserver.disconnect(),this.syncMenuItems();const t=this.querySelector(".sf-context-menu-content");t&&this._itemObserver.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled","aria-disabled","hidden","inert"]})}disconnectedCallback(){this._owned&&this.close({restoreFocus:!1}),this._itemObserver.disconnect();for(const e of this._itemAttributes.keys())this.releaseItem(e);this._currentItem=null,super.disconnectedCallback()}menuItems(){if("default"!==this.templateName||"menu"!==this.role)return[];const e=this.querySelector(".sf-context-menu-content");return this.entries.length?Array.from(e?.querySelectorAll(".sf-context-menu-item")||[]):Array.from(e?.children||[]).flatMap(e=>{const t="sf-button"===e.localName?e.querySelector("button, a[href]"):e;if(!t?.matches("button, a[href]"))return[];const n=t.getAttribute("role");return n&&"menuitem"!==n?[]:[t]})}availableMenuItems(){return this.menuItems().filter(e=>!e.matches(":disabled")&&!e.closest('[hidden], [inert], [aria-disabled="true"], sf-button[disabled]')&&e.getClientRects().length>0&&"hidden"!==getComputedStyle(e).visibility)}ownItemAttribute(e,t,n){let s=this._itemAttributes.get(e);s||this._itemAttributes.set(e,s=new Map);let i=s.get(t);i||(i={original:e.getAttribute(t),value:e.getAttribute(t),released:!1},s.set(t,i)),i.released||e.getAttribute(t)!==i.value?i.released=!0:(i.value!==n&&e.setAttribute(t,n),i.value=n)}releaseItem(e){for(const[t,n]of this._itemAttributes.get(e)||[])n.released||e.getAttribute(t)!==n.value||(null===n.original?e.removeAttribute(t):e.setAttribute(t,n.original));this._itemAttributes.delete(e)}syncMenuItems(){const e=this.menuItems(),t=this.availableMenuItems();for(const t of this._itemAttributes.keys())e.includes(t)||this.releaseItem(t);t.includes(this._currentItem)||(this._currentItem=t[0]||null);for(const t of e)t.classList.contains("sf-context-menu-item")||this.ownItemAttribute(t,"role","menuitem"),this.ownItemAttribute(t,"tabindex",t===this._currentItem?"0":"-1")}focus(e){this.syncMenuItems(),this._currentItem?.focus(e)}get entries(){if(Array.isArray(this._entries))return this._entries;if(!this.hasAttribute("entries"))return[];try{const e=JSON.parse(this.getAttribute("entries"));return Array.isArray(e)?e:[]}catch{return[]}}set entries(e){this._entries=Array.isArray(e)?e:null,this.requestComponentUpdate("entries")}entryOf(e){const t=e?.closest?.(".sf-context-menu-item");return t&&this.contains(t)?this.entries[Number(t.dataset.sfEntry)]??null:null}get search(){return this._search&&"object"==typeof this._search?this._search:null}set search(e){this._search=e&&"object"==typeof e?e:null,this.requestComponentUpdate("search")}get query(){return this._query??""}setQuery(e){this._query=String(e??""),this.requestComponentUpdate("query"),this.search?.remote&&this.dispatchEvent(new CustomEvent("sf-context-menu-search",{bubbles:!0,composed:!0,detail:{query:this._query}}))}searchField(){return this.querySelector(".sf-context-menu-search-input")}chooseOption(e,t){const n=Number(e.dataset.sfOption),s=t.options?.[n];if(!s||s.disabled)return;if(!this.dispatchEvent(new CustomEvent("sf-context-menu-select",{bubbles:!0,composed:!0,cancelable:!0,detail:{id:s.id??null,entry:s,checked:!0,group:t.id??null}})))return;const i=this.entries.indexOf(t),r={...t,options:t.options.map((e,t)=>({...e,checked:t===n}))};this.entries=this.entries.map((e,t)=>t===i?r:e),!1===t.keepOpen&&this.closeAll()}handleEntryClick(e){const t=e.target?.closest?.(".sf-context-menu-item");if(!t||!this.contains(t)||t.matches(":disabled"))return;const n=this.entryOf(t);if(!n)return;if(void 0!==t.dataset.sfOption)return void this.chooseOption(t,n);if(Array.isArray(n.submenu)&&n.submenu.length)return e.preventDefault(),void this.openSubmenu(t,n,{focus:0===e.detail||n.search?"first":"none"});const s="check"===n.kind||"radio"===n.kind,i={id:n.id??null,entry:n,checked:s?"radio"===n.kind||!n.checked:null};this.dispatchEvent(new CustomEvent("sf-context-menu-select",{bubbles:!0,composed:!0,cancelable:!0,detail:i}))&&!n.keepOpen&&this.closeAll({restoreFocus:!n.href})}handleEntryHover(e){if(!this._owned||"touch"===e.pointerType)return;const t=e.target?.closest?.(".sf-context-menu-item");t&&this.contains(t)&&t!==this._hoverRow&&(this._hoverRow=t,clearTimeout(this._hoverTimer),this._hoverTimer=setTimeout(()=>{if(this._hoverRow!==t||!this._owned)return;const e=this.entryOf(t);e&&Array.isArray(e.submenu)&&e.submenu.length&&!t.matches(":disabled")?this.openSubmenu(t,e,{focus:"none"}):this.closeSubmenu({restoreFocus:!1})},120))}toggleFor(e,t={}){return this._owned?.anchor===e?(this.close(),Promise.resolve(!1)):this.openFor(e,t)}get isOpen(){return Boolean(this._owned)}surface(){return this.querySelector(":scope > .sf-context-menu")}async openFor(e,{side:t="block-end",align:n="start",focus:s="first",parentMenu:i=null,alignmentOffset:r=0,width:o=this.width}={}){if(!(e instanceof Element))throw new TypeError("A menu opens for an element");this._owned&&this.close({restoreFocus:!1}),await this.whenRendered();const l=this.surface();if(!l)return!1;const c=document.activeElement;var u;this._owned={anchor:e,parentMenu:i,returnTo:c instanceof HTMLElement&&c!==document.body&&c!==document.documentElement?c:(u=e,u?.matches?.("button, a[href], input, select, textarea, [tabindex]")?u:u?.querySelector?.("button, a[href], input, select, textarea, [tabindex]")??u),expanded:e.getAttribute("aria-expanded"),haspopup:e.getAttribute("aria-haspopup")},e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","true"),l.classList.add("sf-context-menu--open"),"function"==typeof l.showPopover?(l.setAttribute("popover","manual"),l.matches(":popover-open")||l.showPopover()):l.style.zIndex="var(--sf-z-index-9)";const h=this.querySelector(".sf-context-menu-content");if(o&&"content"!==o&&h){const t="trigger"===o?`${e.getBoundingClientRect().width}px`:o;h.style.setProperty("--sf-context-menu--min-inline-size",t),h.style.setProperty("--sf-context-menu--max-inline-size",t),h.style.setProperty("inline-size",t),this._owned.sizedContent=h}if(this._owned.position=d().anchor(e,l,{side:t,align:n,alignmentOffset:r,flip:!0,shift:!0,fitHeight:!0,matchWidth:"trigger"===o}),document.addEventListener("pointerdown",this._onOutsidePress,!0),(0,a.Ec)(this,!0),this.dispatchEvent(new CustomEvent("sf-context-menu-open",{bubbles:!0,composed:!0})),"none"!==s){this.syncMenuItems();const e=this.availableMenuItems(),t=this.searchField();t&&"last"!==s?t.focus({preventScroll:!0}):("last"===s?e[e.length-1]:e[0])?.focus({preventScroll:!0})}return!0}close({restoreFocus:e=!0}={}){const t=this._owned;if(!t)return!1;this.closeSubmenu({restoreFocus:!1}),this._owned=null,this._hoverRow=null,this._query&&(this._query="",this.requestComponentUpdate("query")),clearTimeout(this._hoverTimer),t.position?.stop();for(const e of["--sf-context-menu--min-inline-size","--sf-context-menu--max-inline-size","inline-size"])t.sizedContent?.style.removeProperty(e);document.removeEventListener("pointerdown",this._onOutsidePress,!0),(0,a.Ec)(this,!1);const n=this.surface();n&&(n.matches?.(":popover-open")&&n.hidePopover(),n.removeAttribute("popover"),n.classList.remove("sf-context-menu--open"),n.style.removeProperty("z-index"));const{anchor:s}=t;return null===t.haspopup?s.removeAttribute("aria-haspopup"):s.setAttribute("aria-haspopup",t.haspopup),null===t.expanded?s.setAttribute("aria-expanded","false"):s.setAttribute("aria-expanded",t.expanded),e&&(t.returnTo?.isConnected?t.returnTo:s)?.focus?.({preventScroll:!0}),this.dispatchEvent(new CustomEvent("sf-context-menu-close",{bubbles:!0,composed:!0})),!0}closeAll({restoreFocus:e=!0}={}){let t=this;for(;t._owned?.parentMenu;)t=t._owned.parentMenu;return t===this?this.close({restoreFocus:e}):t.close({restoreFocus:e})}async openSubmenu(e,t,{focus:n="first"}={}){if(this._submenu?._owned?.anchor===e)return"none"!==n&&this._submenu.focus(),this._submenu;this.closeSubmenu({restoreFocus:!1});const s=document.createElement("sf-context-menu");s.setAttribute("aria-label",t.text??""),s.setAttribute("popup",""),"1"===this.size&&s.setAttribute("size","1"),s.entries=t.submenu,t.search&&(s.search=t.search),s.addEventListener("sf-context-menu-select",e=>{e.stopPropagation();this.dispatchEvent(new CustomEvent("sf-context-menu-select",{bubbles:!0,composed:!0,cancelable:!0,detail:e.detail}))||e.preventDefault()}),s.addEventListener("sf-context-menu-close",()=>{this._submenu===s&&(this._submenu=null,s.remove())}),(this.closest("dialog[open]")||document.body).append(s),this._submenu=s;const i=this.querySelector(".sf-context-menu-content"),r=i?getComputedStyle(i):null,o=r?(parseFloat(r.paddingTop)||0)+(parseFloat(r.borderTopWidth)||0):0;return await s.openFor(e,{side:"inline-end",align:"start",focus:n,parentMenu:this,alignmentOffset:-o}),s}closeSubmenu({restoreFocus:e=!0}={}){const t=this._submenu;return!!t&&(this._submenu=null,t.close({restoreFocus:e}),t.remove(),!0)}handleOwnedKeyDown(e){if(!this._owned||e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey)return;if(!this.contains(e.target))return;const t="rtl"===getComputedStyle(this.surface()??document.documentElement).direction,n=t?"ArrowLeft":"ArrowRight",s=t?"ArrowRight":"ArrowLeft",i=e.target?.closest?.(".sf-context-menu-choice-option");if(i&&(e.key===n||e.key===s)){const t=Array.from(i.parentElement.querySelectorAll(".sf-context-menu-choice-option:not(:disabled)")),s=t.indexOf(i),r=t[(s+(e.key===n?1:t.length-1))%t.length];return e.preventDefault(),void r?.focus()}if(e.target===this.searchField()&&"Escape"!==e.key&&"Tab"!==e.key)return void("ArrowDown"===e.key&&(e.preventDefault(),this.syncMenuItems(),this.availableMenuItems()[0]?.focus()));if("Escape"===e.key||e.key===s&&this._owned.parentMenu)return e.preventDefault(),e.stopPropagation(),void this.close();if("Tab"===e.key)return void this.closeAll({restoreFocus:!0});const r=this.entryOf(e.target);if(e.key===n&&r&&Array.isArray(r.submenu)&&r.submenu.length)return e.preventDefault(),void this.openSubmenu(e.target.closest(".sf-context-menu-item"),r,{focus:"first"});1===e.key.length&&" "!==e.key&&this.typeahead(e)}typeahead(e){const t=Date.now();this._typeahead.text=(t-this._typeahead.at>m?"":this._typeahead.text)+e.key.toLowerCase(),this._typeahead.at=t;const n=this.availableMenuItems(),s=Math.max(0,n.indexOf(e.target)),i=[...n.slice(s+(1===this._typeahead.text.length?1:0)),...n.slice(0,s+1)].find(e=>(e.querySelector(".sf-context-menu-item-label")?.textContent??e.textContent).trim().toLowerCase().startsWith(this._typeahead.text));i&&(e.preventDefault(),i.focus())}handleMenuKeyDown(e){if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;const t=this.availableMenuItems(),n=t.indexOf(e.target);if(n<0)return;let s;switch(e.key){case"ArrowDown":s=(n+1)%t.length;break;case"ArrowUp":s=(n+t.length-1)%t.length;break;case"Home":s=0;break;case"End":s=t.length-1;break;default:return}e.preventDefault(),e.stopPropagation(),t[s].focus()}static get props(){return{templateName:{attribute:"template",default:"default"},position:{default:""},tooltip:{type:Boolean,default:!0},text:{default:""},ariaLabel:{default:""},items:{type:Array,default:[]},entries:{type:Array,default:[]},popup:{type:Boolean,default:!1},role:{default:"menu"},contentClass:{default:""},rootClass:{default:""},size:{default:"1/2"},width:{default:"content"},tabs:{default:""},activeTab:{attribute:"active-tab",default:""},closable:{type:Boolean,default:!1}}}get tabs(){const e=Array.isArray(this._tabs)?this._tabs:this.getAttribute("tabs")||"";return(Array.isArray(e)?e:String(e).split("|").map(e=>e.trim()).filter(Boolean)).map((e,t)=>"string"==typeof e?{id:e,label:e,index:t}:{id:String(e.id??t),label:String(e.label??e.id??t),index:t})}set tabs(e){if(Array.isArray(e))return this._tabs=e,void this.requestComponentUpdate("tabs");this._tabs=null,this.setState({tabs:e?String(e):""})}get activeTab(){const e=this.tabs,t=this.getAttribute("active-tab")??"";return e.find(e=>e.id===t)??e[Number(t)]??e[0]??null}get closable(){return this.getBooleanAttr("closable",!1)}get panel(){return this.tabs.length>0}chooseTab(e){const t=this.tabs[e];return t&&t.id!==this.activeTab?.id?(this.setState({activeTab:t.id}),this.dispatchEvent(new CustomEvent("sf-context-menu-tab",{bubbles:!0,composed:!0,detail:{id:t.id,index:t.index}})),this):this}requestClose(){return this._owned?this.close():(this.dispatchEvent(new CustomEvent("sf-context-menu-close",{bubbles:!0,composed:!0})),!0)}get templateName(){return this.getAttribute("template")||"default"}get position(){return f(this.getAttribute("position"))}get tooltip(){return this.getBooleanAttr("tooltip",!0)}get text(){return this.getAttribute("text")||""}get ariaLabel(){return this.getAttribute("aria-label")||""}get role(){return this.getAttribute("role")||"menu"}get size(){return"1"===this.getAttribute("size")?"1":"1/2"}get width(){return this.getAttribute("width")||"content"}get contentClass(){return this.getAttribute("content-class")||""}templateContext(){const e=this.getPropsContext();return this.createTemplateContext({...e,entries:this.entries,search:this.search,query:this.query,tabs:this.tabs,activeTab:this.activeTab,closable:this.closable,closeLabel:(0,o.pageText)(h,"close",this,"sf-context-menu"),panel:this.panel,position:this.position,size:this.size,component:this,rootClass:this.getRootClass()})}template(){return(0,r.x)(this.templateContext())}}b.define("sf-context-menu"),t()}catch(g){t(g)}})},"1197ac823db7"(e,t,n){n.a(e,async(e,s)=>{try{n.d(t,{x:()=>$});var i=n("ddf1cdb42ecc"),r=e([i]),o=r.then?(await r)():r;i=o[0];function a(...e){return e.flat().filter(Boolean).join(" ")}function l(e){if("sf-button"===e?.component){const t=e.props||{},n=t["@click"];return i.html`
2
2
  <sf-button
3
3
  appearance=${t.type||"default"}
4
4
  scheme=${t.scheme||"primary"}
@@ -546,7 +546,7 @@
546
546
  "source_artifacts": [
547
547
  {
548
548
  "path": "src/smart/context-menu/index.js",
549
- "sha256": "9bd28543965d1f8a3a5a738d02a1e4e8228a7194b3142352ef270e30978cc9d8"
549
+ "sha256": "2b6c3fedc78651c27e99726a4199c7845cbf867e6f229d4d20af75f8118725bb"
550
550
  },
551
551
  {
552
552
  "path": "src/smart/context-menu/js/templates/default.js",
@@ -1,4 +1,4 @@
1
- (()=>{"use strict";var e={c0450586011d(e,a,s){s.a(e,async(e,t)=>{try{s.d(a,{Dk:()=>T,Ue:()=>J,Xx:()=>A,_i:()=>ce,nD:()=>ue,nK:()=>ke});var n=s("d7f974466839"),o=s("58661bec99a6"),i=s("8c672a55a76a"),l=s("c614c5e30b0d"),r=s("67eed2647f47"),m=s("0ab12d47912a"),d=s("5c1dc214bb5e"),f=s("98e26702f55a"),u=s("0d662e4d7d63"),c=e([d,u]);[d,u]=c.then?(await c)():c;var h=s.n(d);const k={en:{phoneLabel:"Phone number",phoneRequired:"Enter a phone number.",countryLabel:"Country code"},ru:{phoneLabel:"Телефон",phoneRequired:"Введите номер телефона.",countryLabel:"Код страны"}},y=()=>globalThis.SF?.Position||h(),p=".sf-country-code",H="sfCountryCodeBound",g=Array.isArray(l?.items)?l.items:[];let E=null,P=0;const C=new WeakMap,b=new WeakMap,R=new WeakMap,j=new WeakMap,w=new WeakMap;function x(e,a){if(!a)return;const s=j.get(a)||{},t=e.querySelector(".sf-country-code-text"),n=e.querySelector(".sf-country-code-hint"),o=C.get(a),i=a.hasAttribute("aria-label")&&a.getAttribute("aria-label")!==o;for(const[e,o]of[["aria-labelledby",t],["aria-describedby",n]]){const t=o?.textContent.trim()?o:null;let n=(a.getAttribute(e)||"").split(/\s+/).filter(Boolean);const l=o&&/^sf-country-\d+$/.test(o.id)&&n.includes(o.id)?o.id:"",r=s[e]||l;n=n.filter(e=>e!==r);const m=t&&("aria-describedby"===e||!i&&0===n.length)?_(t):"";m&&n.push(m);const d=[...new Set(n)].join(" ");d!==(a.getAttribute(e)||"")&&(d?a.setAttribute(e,d):a.removeAttribute(e)),s[e]=m}if(j.set(a,s),t?.textContent.trim()||a.hasAttribute("aria-labelledby"))o&&a.getAttribute("aria-label")===o&&a.removeAttribute("aria-label");else if(!i){const s=(0,u.pageText)(k,"phoneLabel",e,"sf-country-code");a.getAttribute("aria-label")!==s&&a.setAttribute("aria-label",s),C.set(a,s)}}function S(e,a){const s=R.get(a);if(a.validity.customError&&a.validationMessage!==s)return;const t=e.__sfCountryConfig||{},n=String(a.value||"").trim(),o=t.showCode?K(n,e.dataset.dialCode):n,i=a.required&&""!==n&&!/\d/.test(o)?(0,u.pageText)(k,"phoneRequired",e,"sf-country-code"):"";a.setCustomValidity(i),R.set(a,i)}function _(e){if(!e)return"";if(!e.id||document.getElementById(e.id)&&document.getElementById(e.id)!==e)do{e.id="sf-country-"+ ++P}while(document.getElementById(e.id)&&document.getElementById(e.id)!==e);return e.id}function v(e,a){if(!e||e.hasAttribute("aria-labelledby"))return;const s=C.get(e);e.hasAttribute("aria-label")&&e.getAttribute("aria-label")!==s||(e.setAttribute("aria-label",a),C.set(e,a))}function M(e){const{input:a,toggle:s,list:t,items:n}=N(e),o=e.__sfCountryConfig||{},i=e.classList.contains("open"),l=e.__sfCountrySelected,r=(0,u.pageText)(k,"countryLabel",e,"sf-country-code");x(e,a),e.querySelectorAll(".sf-country-code-required, .sf-country-code-left .sf-icon").forEach(e=>e.setAttribute("aria-hidden","true")),s&&(o.multiCountry&&o.showCode&&t?(v(s,`${r}${l?`: ${Z(l,o.locale)}`:""}`),s.setAttribute("role","button"),s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-controls",_(t)),s.setAttribute("aria-expanded",String(i))):(s.removeAttribute("aria-haspopup"),s.removeAttribute("aria-controls"),s.removeAttribute("aria-expanded"),s.removeAttribute("aria-disabled"),s.removeAttribute("role"),s.getAttribute("aria-label")===C.get(s)&&(s.removeAttribute("aria-label"),C.delete(s)),s.tabIndex=-1)),t&&(t.setAttribute("role","listbox"),v(t,r),t.setAttribute("aria-hidden",String(!i)),t.inert=!i);let m=!1;for(const e of n){const a=!m&&!!l&&(l.iso2?A(e.dataset.iso2)===l.iso2:e.dataset.code===l.dialCode);m||=a,e.setAttribute("role","option"),e.setAttribute("aria-selected",String(a)),e.tabIndex=i&&e===document.activeElement?0:-1}}function L(e,a=!1){return null==e||""===e?a:"boolean"==typeof e?e:["1","true","yes","on","active","open","disabled"].includes(String(e).toLowerCase())}function A(e){return String(e||"").trim().toUpperCase()}function T(){const e="undefined"!=typeof window?window.sfPath:"";if(!e)return"";try{return new URL("component/flag/flags/rect",e).href.replace(/\/$/,"")}catch{return String(e).replace(/\/$/,"")+"/component/flag/flags/rect"}}function I(e,a){const s=A(e).toLowerCase();return s&&a?`${a}/${s}.svg`:""}function B(e){if(!e||"1"===e.dataset.loaded)return;const a=e.dataset.flagSrc||"";a&&(e.src=a,e.dataset.loaded="1")}function $(e,a=!0){if(!e)return;if(!a)return void B(e);const s=(E||!("IntersectionObserver"in window)||(E=new IntersectionObserver(e=>{e.forEach(e=>{if(!e.isIntersecting)return;const a=e.target;B(a),E?.unobserve?.(a)})},{rootMargin:"120px"})),E);s?s.observe(e):B(e)}function F(e,a,s=!0){const t=document.createElement("div");t.classList.add("sf-country-code-flag"),t.setAttribute("aria-hidden","true");const n=e?.flagEmoji||"",o=I(e?.iso2,a.flagBase);if(!o)return t.textContent=n,t;const i=document.createElement("img");return i.alt=e?.iso2?`${e.iso2} flag`:"flag",i.decoding="async",i.loading="lazy",i.dataset.flagSrc=o,i.dataset.flagFallback=n,i.addEventListener("error",()=>{t.textContent=n},{once:!0}),$(i,s&&a.lazyFlags),t.append(i),t}function N(e){return{input:e?.querySelector?.(".sf-country-code-field input")||null,toggle:e?.querySelector?.(".sf-country-code-left")||null,list:e?.querySelector?.(".sf-country-code-list")||null,itemsWrap:e?.querySelector?.(".sf-country-code-items")||null,items:Array.from(e?.querySelectorAll?.(".sf-country-code-item")||[]),leftFlag:e?.querySelector?.(".sf-country-code-left .sf-country-code-flag-icon")||e?.querySelector?.(".sf-country-code-left .sf-country-code-flag")||null}}function O(e){const a=A(e);return a&&g.find(e=>e.iso2===a)||null}function D(e){const a=String(e||"").trim();return a&&g.find(e=>e.dialCode===a)||null}function q(e,a="native"){const s=String(e||"").trim();if(!s)return s;if("brackets"!==a)return s;const t=s.replace(/[()]/g,""),n=t.match(/^(\+\S+)\s+(.+)$/);if(!n)return t;const o=n[1],i=n[2].trim();if(!i)return t;const l=i.indexOf(" ");let r=l>=0?i.slice(0,l):i,m=l>=0?i.slice(l+1).trim():"",d=r;if(r.includes("-")){const[e,...a]=r.split("-");d=e;m=[a.join("-"),m].filter(Boolean).join(" ")}return d?`${o} (${d})${m?` ${m}`:""}`.trim():t}function z(e,a,s=""){const t=String(e||"");if(!t)return"";const n=a||"_",o=String(s||"").replace(/\D/g,"");let i=0;return t.replace(/0/g,()=>{if(i<o.length){const e=o[i];return i+=1,e}return n})}function G(e){return String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K(e,a){const s=String(e||"").trim();if(!s)return"";if(a){const e=G(a.trim()),t=new RegExp(`^${e}[\\s\\-()]*`,"i"),n=s.replace(t,"").trim();if(n!==s)return n}return s.replace(/^\+\d+[\s\-()]*/,"").trim()}function U(e=null){document.querySelectorAll(p).forEach(a=>{e&&a===e||V(a,!1)})}function V(e,a){if(!e)return;const{input:s}=N(e);(s?.disabled||e.classList.contains("disabled")||!1===e.__sfCountryConfig?.multiCountry)&&(a=!1),a?e.classList.add("open"):e.classList.remove("open"),M(e),e.__sfCountryViewport?.(a)}function W(e,a){const s=String(e.dataset.locale||a?.dataset.locale||(0,u.pageLanguage)(e)).toLowerCase(),t="brackets"===String(e.dataset.maskStyle??a?.dataset.maskStyle??"native").toLowerCase()?"brackets":"native";return{locale:"ru"===s?"ru":"en",useMask:L(e.dataset.useMask??a?.dataset.useMask,!1),useCountryMasks:L(e.dataset.useCountryMasks??a?.dataset.useCountryMasks,!0),showCode:L(e.dataset.showCode??a?.dataset.showCode,!0),maskStyle:t,multiCountry:L(e.dataset.multiCountry??a?.dataset.multiCountry,!0),defaultIso2:A(e.dataset.iso2??a?.dataset.iso2),fixedDialCode:String(e.dataset.dialCode??a?.dataset.dialCode??"").trim(),fixedMaskPattern:String(e.dataset.maskPattern??a?.dataset.maskPattern??"").trim(),flagBase:String(e.dataset.flagBase||a?.dataset.flagBase||"").trim()||T(),lazyFlags:L(e.dataset.lazyFlags??a?.dataset.lazyFlags,!0),showMaskPlaceholder:L(e.dataset.showMaskPlaceholder??a?.dataset.showMaskPlaceholder,!1),maskPlaceholderChar:String(e.dataset.maskPlaceholderChar??a?.dataset.maskPlaceholderChar??"_"),maxItems:Number.parseInt(e.dataset.maxItems||a?.dataset.maxItems||"0",10)||0}}function Z(e,a){if(!e)return"";if(e.label)return String(e.label);const s=("en"===a?e.nameEn||e.nameRu:e.nameRu||e.nameEn)||e.iso2;return s?`${s} (${e.dialCode})`:String(e.dialCode||"")}function J(e,a="ru",s=0){let t=Array.isArray(e)&&e.length?e:g;return Number(s)>0&&(t=t.slice(0,Number(s))),t.filter(e=>e&&"object"==typeof e).map(e=>{const s=A(e.iso2),t=String(e.dialCode||e.code||"").trim(),n=O(s)||!s&&D(t)||{},o={...n,...e,iso2:s||n.iso2||"",dialCode:t||n.dialCode||""};return o.label=Z(o,a),o})}function Y(e,a){const s=e.cloneNode(!0);return s.querySelectorAll('.sf-country-code-flag, [aria-hidden="true"]').forEach(e=>e.remove()),J([{iso2:e.dataset.iso2,code:e.dataset.code,label:s.textContent.trim(),...e.hasAttribute("data-mask-pattern")?{maskPattern:e.dataset.maskPattern}:{}}],a)[0]}function X(e,a="",s=""){const t=e.__sfCountryOptions||[],n=A(a),o=String(s||"").trim();return n&&t.find(e=>e.iso2===n)||o&&t.find(e=>e.dialCode===o)||O(n)||D(o)}function Q(e,a){const{list:s,itemsWrap:t}=N(e);if(s&&t)return{list:s,itemsWrap:t};const n=document.createElement("span");n.classList.add("sf-country-code-list");const o=document.createElement("span");o.classList.add("sf-country-code-items","flex","flex-col"),n.append(o);const i=e.querySelector(".sf-country-code-field");return i?i.insertAdjacentElement("afterend",n):e.append(n),a.multiCountry||n.classList.add("hidden"),{list:n,itemsWrap:o}}function ee(e,a){if(!a.multiCountry)return;const{itemsWrap:s}=Q(e,a);if(!s)return;if(s.children.length>0)return;const t=a.maxItems>0?g.slice(0,a.maxItems):g,n=document.createDocumentFragment();t.forEach(e=>{const s=document.createElement("span");s.classList.add("sf-country-code-item","flex","items-center","transition"),s.dataset.iso2=e.iso2,s.dataset.code=e.dialCode,e.maskPattern&&(s.dataset.maskPattern=e.maskPattern);const t=F(e,a,!0),o=document.createElement("span");o.textContent=Z(e,a.locale),s.append(t,o),n.append(s)}),s.append(n)}function ae(e){const{list:a}=N(e);a&&a.querySelectorAll("img[data-flag-src]").forEach(e=>$(e,!0))}function se(e,a=8){const{list:s,itemsWrap:t}=N(e);if(!s||!t||a<=0||!e.classList.contains("open"))return 0;const n=Array.from(t.querySelectorAll(".sf-country-code-item")).slice(0,a),o=n.map(e=>e.offsetHeight);if(!o.some(Boolean))return 0;const i=window.getComputedStyle(t),l=Number.parseFloat(i.rowGap||"")||Number.parseFloat(i.gap||"")||0,r=o.reduce((e,a)=>e+a,0)+(n.length-1)*l+(Number.parseFloat(i.paddingTop||"")||0)+(Number.parseFloat(i.paddingBottom||"")||0);return Object.assign(t.style,{maxHeight:`${r}px`,minHeight:"0",overflowY:"auto",overflowX:"hidden"}),r}function te(e){const{list:a,itemsWrap:s}=N(e);if(!a||!s)return;let t=null,n=null;e.__sfCountryViewport=s=>{if(s&&!t&&e.isConnected)n=["display","flex-direction","overflow"].map(e=>[e,a.style.getPropertyValue(e),a.style.getPropertyPriority(e)]),Object.assign(a.style,{display:"flex",flexDirection:"column",overflow:"hidden"}),se(e),t=y().anchor(e,a,{side:"block-end",align:"start",matchWidth:!0,fitHeight:!0,onPosition:()=>{const a=e.getBoundingClientRect();(a.bottom<=0||a.top>=window.innerHeight)&&V(e,!1)}});else if(!s&&t){t.stop(),t=null;for(const[e,s,t]of n)s?a.style.setProperty(e,s,t):a.style.removeProperty(e)}else s&&t&&(se(e),t.update())}}function ne(e,a){for(let s=e;s;s=Object.getPrototypeOf(s)){const e=Object.getOwnPropertyDescriptor(s,a);if(e)return"function"==typeof e.set||!0===e.writable}return!1}async function oe(e,a,s,t=null){if(!a)return;const n=Symbol("country-code-mask");if(e.__sfCountryMaskToken=n,e.__sfCountryMask&&(window.SF?.Mask?.destroy?.(e.__sfCountryMask),delete e.__sfCountryMask),!s)return;const o=await(0,m.y)();if(n!==e.__sfCountryMaskToken)return;const i=a.value;try{const l=t||e.__sfCountryConfig||W(e,a),r=""!==String(i||"").trim(),m=l.showMaskPlaceholder&&r;if(!r&&s){const t=e?.dataset?.dialCode||l.fixedDialCode||"";a.placeholder=z(s,l.maskPlaceholderChar||"_",t)}const d=await o.create(a,{mask:s,lazy:!m,placeholderChar:l.maskPlaceholderChar||"_"});if(!d||n!==e.__sfCountryMaskToken)return void window.SF?.Mask?.destroy?.(d);if(e.__sfCountryMask=d,i){const e=String(i).replace(/\D+/g,"");e&&ne(d,"unmaskedValue")?d.unmaskedValue=e:ne(d,"value")&&(d.value=String(i)),"function"==typeof d.updateValue&&d.updateValue(),a.value=d.value||a.value}S(e,a)}catch(e){console.warn("SF.CountryCode mask init failed",e)}}function ie(e,a){return X(a,e.defaultIso2)||X(a,"",e.fixedDialCode)||a.__sfCountryOptions?.[0]||g[0]||null}function le(e){const{input:a,toggle:s}=N(e);if(!a)return;const t=e.classList.contains("disabled"),n=L(a.disabled,!1),o=t||n;e.classList.toggle("disabled",o),s&&(s.setAttribute("aria-disabled",o?"true":"false"),s.tabIndex=o?-1:0),o&&V(e,!1),M(e)}function re(e,a){if(!a?.showCode)return"";const s=String(e?.dataset?.dialCode||"").trim();return s?`${s} `:""}function me(e,a,s){if(!a)return;const t=re(e,s);if(!t)return;const n=String(a.value||"");if(n.startsWith(t))return;const o=K(n,e?.dataset?.dialCode||"");a.value=`${t}${o}`.trimEnd()}function de(e,a){if(!e||!a)return;const s=e.selectionStart??0,t=e.selectionEnd??0;if(s>=a.length&&t>=a.length)return;const n=a.length;e.setSelectionRange(n,n)}function fe(e,a,s="runtime"){if(!e||!a)return;const{input:t,leftFlag:n}=N(e);if(!t)return;const o=e.__sfCountryConfig||W(e,t),i=e.dataset.dialCode||"";e.dataset.iso2=a.iso2,e.dataset.dialCode=a.dialCode,e.dataset.maskPattern=a.maskPattern||"";const l=w.get(e);if(l&&(l.selected=e.dataset.maskPattern),e.__sfCountrySelected=a,o.showCode&&n){const e=F(a,o,!1),s=e.querySelector("img");n.textContent="",s?n.append(s):n.textContent=e.textContent||""}if("item"===s||"state"===s){const s=K(t.value,i);oe(e,t,"",o);const n=a.dialCode?`${a.dialCode} `:"";t.value=`${n}${s}`.trim(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}if(o.useMask){oe(e,t,q(o.useCountryMasks?a.maskPattern:o.fixedMaskPattern||a.maskPattern,o.maskStyle),o)}else oe(e,t,"",o);M(e),S(e,t)}function ue(e,{resetCountry:a=!1,countries:s,maskPattern:t}={}){if((0,f.vl)(e,"sf-country-code"),e?.__sfCountryCodeBind&&e.__sfCountryCodeBind!==ue)return e.__sfCountryCodeBind(e,{resetCountry:a,countries:s,maskPattern:t});if(!e||"function"==typeof e.__sfCountryCodeInput)return;const{input:n,toggle:o,leftFlag:i}=N(e);if(!n)return;e.__sfCountryCodeBind=ue,e.__sfCountryCodeSetState=ke;const l=W(e,n),m=w.get(e),d=void 0!==t?String(t).trim():m&&l.fixedMaskPattern===m.selected?m.fixed:l.fixedMaskPattern;l.fixedMaskPattern=d,w.set(e,{fixed:d,selected:e.dataset.maskPattern}),e.__sfCountryConfig=l,ee(e,l),se(e,8);const u=N(e),c=u.items;if(te(e),e.__sfCountryOptions=void 0===s?c.map(e=>Y(e,l.locale)):J(s,l.locale,l.maxItems),!l.showCode&&o?o.classList.add("hidden"):o&&o.classList.remove("hidden"),l.multiCountry)e.classList.remove("sf-country-code--fixed-dial-code"),u.list?.classList?.remove("hidden");else{e.classList.add("sf-country-code--fixed-dial-code"),e.classList.remove("open"),u.list?.classList?.add("hidden");const a=o?.querySelector?.(".sf-icon");a&&a.remove()}const h=ie(l,e);!a&&b.has(n)||b.set(n,h),h?fe(e,h,"init"):i&&(i.textContent="");const k=a=>{if(a.preventDefault(),!l.multiCountry||n.disabled||e.classList.contains("disabled"))return;const s=!e.classList.contains("open");U(e),V(e,s),s&&ae(e)},y=a=>{a.altKey||a.ctrlKey||a.metaKey||n.disabled||e.classList.contains("disabled")||!l.multiCountry||("Enter"!==a.key&&" "!==a.key||(a.preventDefault(),k(a),e.classList.contains("open")&&P()),"ArrowDown"!==a.key&&"ArrowUp"!==a.key||(a.preventDefault(),e.classList.contains("open")||k(a),P("ArrowUp"===a.key?-1:void 0)),"Escape"===a.key&&V(e,!1))},p=a=>{e.contains(a.target)||V(e,!1)},g=a=>{if(a.preventDefault(),n.disabled||e.classList.contains("disabled")||!l.multiCountry)return;const s=a.currentTarget;if("true"===s.getAttribute("aria-disabled")||s.classList.contains("disabled"))return;const t=Y(s,l.locale);t&&(fe(e,t,"item"),V(e,!1),("keydown"===a.type?o:n)?.focus({preventScroll:!0}))},E=()=>c.filter(e=>"true"!==e.getAttribute("aria-disabled")&&!e.classList.contains("disabled")&&!e.hidden),P=e=>{const a=E(),s=a.findIndex(e=>"true"===e.getAttribute("aria-selected")),t=void 0===e?Math.max(0,s):e<0?a.length-1:Math.min(e,a.length-1);c.forEach(e=>{e.tabIndex=-1});const n=a[t];if(!n)return;n.tabIndex=0,n.focus({preventScroll:!0});const o=u.itemsWrap;if(o){const e=o.getBoundingClientRect(),a=n.getBoundingClientRect();a.top<e.top?o.scrollTo({top:o.scrollTop-(e.top-a.top),behavior:"instant"}):a.bottom>e.bottom&&o.scrollTo({top:o.scrollTop+(a.bottom-e.bottom),behavior:"instant"})}};let C="",R=0;const j=a=>{if(a.altKey||a.ctrlKey||a.metaKey||n.disabled||e.classList.contains("disabled"))return;const s=E(),t=s.indexOf(a.currentTarget);if("Escape"===a.key)return a.preventDefault(),V(e,!1),void o?.focus({preventScroll:!0});if("Enter"!==a.key&&" "!==a.key){if(["ArrowDown","ArrowUp","Home","End"].includes(a.key)){a.preventDefault();const e="Home"===a.key?0:"End"===a.key?s.length-1:Math.max(0,t+("ArrowDown"===a.key?1:-1));return void P(e)}if(1===a.key.length){const e=performance.now();C=e-R>700?a.key:C+a.key,R=e;const n=[...C].every(e=>e===C[0])?C[0]:C,o=[...s.slice(t+1),...s.slice(0,t+1)].find(e=>(e.querySelector("span")?.textContent||e.textContent).trim().toLocaleLowerCase().startsWith(n.toLocaleLowerCase()));o&&(a.preventDefault(),P(s.indexOf(o)))}}else g(a)},_=a=>{e.contains(a.relatedTarget)||V(e,!1)},v=()=>{me(e,n,l),de(n,re(e,l)),S(e,n)},M=()=>{requestAnimationFrame(()=>{me(e,n,l),de(n,re(e,l))})},L=a=>{const s=re(e,l);if(!s)return;if(!["Backspace","Delete"].includes(a.key))return;const t=n.selectionStart??0,o=n.selectionEnd??t;return"Backspace"===a.key&&t<=s.length||"Delete"===a.key&&t<s.length?(a.preventDefault(),void de(n,s)):void((t<s.length||o<s.length)&&(a.preventDefault(),de(n,s)))};o&&(o.addEventListener("click",k),o.addEventListener("keydown",y),o.setAttribute("role","button")),n.addEventListener("input",v),n.addEventListener("paste",M),n.addEventListener("keydown",L),c.forEach(e=>{e.addEventListener("click",g),e.addEventListener("keydown",j)}),e.addEventListener("focusout",_),document.addEventListener("click",p),e.__sfCountryCodeToggleClick=k,e.__sfCountryCodeToggleKeydown=y,e.__sfCountryCodeDocClick=p,e.__sfCountryCodeItemClick=g,e.__sfCountryCodeItemKeydown=j,e.__sfCountryCodeFocusOut=_,e.__sfCountryCodeInput=v,e.__sfCountryCodePaste=M,e.__sfCountryCodeInputKeydown=L,e.__sfCountryReleaseReset=(0,r.z)(n,()=>{const a=b.get(n);a&&fe(e,a,"reset"),V(e,!1),S(e,n)}),e.__sfCountryRequiredObserver=new MutationObserver(()=>{S(e,n),x(e,n)}),e.__sfCountryRequiredObserver.observe(e,{attributes:!0,attributeFilter:["required","aria-label","aria-labelledby","aria-describedby","id"],childList:!0,characterData:!0,subtree:!0}),e.dataset[H]="1",le(e),e.__sfCountryViewport?.(e.classList.contains("open"))}function ce(e){if(!e||"function"!=typeof e.__sfCountryCodeInput)return;const{input:a,toggle:s,items:t}=N(e);e.__sfCountryReleaseReset?.(),delete e.__sfCountryReleaseReset,e.__sfCountryRequiredObserver?.disconnect(),delete e.__sfCountryRequiredObserver,e.__sfCountryViewport?.(!1),delete e.__sfCountryViewport,e.querySelectorAll("img[data-flag-src]").forEach(e=>E?.unobserve(e)),s&&e.__sfCountryCodeToggleClick&&s.removeEventListener("click",e.__sfCountryCodeToggleClick),s&&e.__sfCountryCodeToggleKeydown&&s.removeEventListener("keydown",e.__sfCountryCodeToggleKeydown),e.__sfCountryCodeDocClick&&document.removeEventListener("click",e.__sfCountryCodeDocClick),t.forEach(a=>{e.__sfCountryCodeItemKeydown&&a.removeEventListener("keydown",e.__sfCountryCodeItemKeydown),e.__sfCountryCodeItemClick&&a.removeEventListener("click",e.__sfCountryCodeItemClick)}),e.__sfCountryCodeFocusOut&&e.removeEventListener("focusout",e.__sfCountryCodeFocusOut),a&&e.__sfCountryCodeInput&&a.removeEventListener("input",e.__sfCountryCodeInput),a&&e.__sfCountryCodePaste&&a.removeEventListener("paste",e.__sfCountryCodePaste),a&&e.__sfCountryCodeInputKeydown&&a.removeEventListener("keydown",e.__sfCountryCodeInputKeydown),e.__sfCountryMask&&window.SF?.Mask?.destroy?.(e.__sfCountryMask),delete e.__sfCountryCodeToggleClick,delete e.__sfCountryCodeToggleKeydown,delete e.__sfCountryCodeDocClick,delete e.__sfCountryCodeItemClick,delete e.__sfCountryCodeItemKeydown,delete e.__sfCountryCodeFocusOut,delete e.__sfCountryCodeInput,delete e.__sfCountryCodePaste,delete e.__sfCountryCodeInputKeydown,delete e.__sfCountryMask,delete e.__sfCountryMaskToken,delete e.__sfCountrySelected,delete e.__sfCountryConfig,delete e.__sfCountryOptions,delete e.dataset[H]}function he(e=document){e.querySelectorAll(p).forEach(e=>{e.closest("sf-country-code")||ue(e)})}function ke(e,a={}){const s=e instanceof HTMLElement?e.closest(p)||e:null;if(!s)return!1;if(s.__sfCountryCodeSetState&&s.__sfCountryCodeSetState!==ke)return s.__sfCountryCodeSetState(s,a);const{input:t}=N(s);if(!t)return!1;if(Object.prototype.hasOwnProperty.call(a,"disabled")){const e=L(a.disabled,!1);t.disabled=e,s.classList.toggle("disabled",e),le(s)}if(Object.prototype.hasOwnProperty.call(a,"active")&&V(s,L(a.active,!1)),Object.prototype.hasOwnProperty.call(a,"open")&&V(s,L(a.open,!1)),Object.prototype.hasOwnProperty.call(a,"value")&&(t.value=String(a.value??""),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))),Object.prototype.hasOwnProperty.call(a,"iso2")){const e=X(s,a.iso2);e&&fe(s,e,"state")}if(Object.prototype.hasOwnProperty.call(a,"dialCode")){const e=X(s,"",a.dialCode);e&&fe(s,e,"state")}return!0}class ye extends n.y{static componentName="CountryCode";html=null;constructor(e){super(e);const{size:a="1",label:s="",required:t=!1,name:n="",form:o="",hint:i="",value:l="",placeholder:r="+7(___)___-__-__",disabled:m=!1,active:d=!1,open:u=d,countries:c=[],locale:h="ru",useMask:k=!1,useCountryMasks:y=!0,showCode:p=!0,maskStyle:H="native",multiCountry:g=!0,iso2:E="",dialCode:P="",maskPattern:C="",flagBase:b="",lazyFlags:R=!0,showMaskPlaceholder:j=!1,maskPlaceholderChar:w="_",maxItems:x=0}=this.params||{},S=this.attrs.class||this.attrs.className;this.template=document.createElement("label"),this.id&&(this.template.id=this.id),this.template.classList.add("sf-country-code",`sf-country-code--size-${(0,f.id)(a,"sf-country-code")}`),L(m)&&this.template.classList.add("disabled"),L(u)&&this.template.classList.add("open"),S&&this.template.classList.add(...`${S}`.split(" ").filter(Boolean)),this.template.dataset.locale=String(h),this.template.dataset.useMask=String(L(k,!1)),this.template.dataset.useCountryMasks=String(L(y,!0)),this.template.dataset.showCode=String(L(p,!0)),this.template.dataset.maskStyle="brackets"===String(H).toLowerCase()?"brackets":"native",this.template.dataset.multiCountry=String(L(g,!0)),this.template.dataset.lazyFlags=String(L(R,!0)),this.template.dataset.showMaskPlaceholder=String(L(j,!1)),this.template.dataset.maskPlaceholderChar=String(w||"_"),E&&(this.template.dataset.iso2=A(E)),P&&(this.template.dataset.dialCode=String(P)),C&&(this.template.dataset.maskPattern=String(C)),b&&(this.template.dataset.flagBase=String(b).replace(/\/$/,"")),Number(x)>0&&(this.template.dataset.maxItems=String(Number(x)));const _=document.createElement("span");_.classList.add("sf-country-code-label");const v=document.createElement("span");if(v.classList.add("sf-country-code-text"),v.textContent=String(s),_.append(v),L(t,!1)){const e=document.createElement("span");e.classList.add("sf-country-code-required"),e.textContent="*",_.append(e)}const M=document.createElement("span");M.classList.add("sf-country-code-field");const I=document.createElement("span");I.classList.add("sf-country-code-left");const B=document.createElement("div");B.classList.add("sf-country-code-flag-icon"),B.setAttribute("aria-hidden","true");const $=document.createElement("i");$.classList.add("sf-icon"),$.textContent=L(u)?"expand_less":"expand_more",I.append(B,$);const N=document.createElement("input");N.type="tel",N.name=String(n),o&&N.setAttribute("form",String(o)),N.required=L(t,!1),N.defaultValue=String(l??""),N.placeholder=String(r??""),N.disabled=L(m,!1),M.append(I,N),this.template.append(_,M);const O=J(c,h,x);if(O.length){const e=document.createElement("span");e.classList.add("sf-country-code-list");const a=document.createElement("span");a.classList.add("sf-country-code-items","flex","flex-col"),O.forEach(e=>{const s=document.createElement("span");s.classList.add("sf-country-code-item"),e?.iso2&&(s.dataset.iso2=A(e.iso2)),(e?.dialCode||e?.code)&&(s.dataset.code=String(e.dialCode||e.code)),void 0!==e?.maskPattern&&(s.dataset.maskPattern=String(e.maskPattern||""));const t=F({iso2:e?.iso2,flagEmoji:e?.flagEmoji||""},{flagBase:this.template.dataset.flagBase||T(),lazyFlags:L(this.template.dataset.lazyFlags,!0)},!0),n=document.createElement("span");if(e?.label)n.textContent=String(e.label);else{const a=e?.nameRu||e?.nameEn||e?.dialCode||"",s=e?.dialCode||e?.code||"";n.textContent=s?`${a} (${s})`:a}s.append(t,n),this.applyLayoutUtilities(s,".sf-country-code .sf-country-code-item"),this.applyLayoutUtilities(t,".sf-country-code .sf-country-code-flag"),a.append(s)}),e.append(a),this.template.append(e)}if(i){const e=document.createElement("span");e.classList.add("sf-country-code-hint"),e.textContent=String(i),this.template.append(e)}this.applyLayoutUtilities(this.template,".sf-country-code"),this.applyLayoutUtilities(_,".sf-country-code .sf-country-code-label"),this.applyLayoutUtilities(M,".sf-country-code .sf-country-code-field"),this.applyLayoutUtilities(I,".sf-country-code .sf-country-code-left"),this.applyLayoutUtilities(N,".sf-country-code .sf-country-code-field input"),this.applyLayoutUtilities(B,".sf-country-code .sf-country-code-flag-icon")}init(){ue(this.template,{maskPattern:this.params?.maskPattern||""})}destroyInternal(){ce(this.template)}}ye.utilityMap=i,(0,o.A)("CountryCode",ye),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.CountryCode=window.SF.CountryCode||{},window.SF.CountryCode.setState=ke),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>he()):he();new MutationObserver(e=>{e.forEach(e=>{e.removedNodes.forEach(e=>{if(!(e instanceof Element))return;const a=[...e.querySelectorAll(p)];e.matches(p)&&a.unshift(e);for(const e of a)e.isConnected||e.closest("sf-country-code")||ce(e)}),e.addedNodes.forEach(e=>{e instanceof Element&&(e.matches?.(p)&&!e.closest("sf-country-code")&&ue(e),he(e))})})}).observe(document.documentElement,{childList:!0,subtree:!0}),t()}catch(pe){t(pe)}})},"98e26702f55a"(e,a,s){function t(){const e=globalThis.SF=globalThis.SF||{};return e.__deprecationNotes instanceof Map||Object.defineProperty(e,"__deprecationNotes",{value:new Map,configurable:!0}),e.__deprecationNotes}function n({component:e="",kind:a="attribute",attribute:s="",from:n,to:o=null}={}){if(!n)return;const i=[e,a,s,n].join("|"),l=t(),r=l.get(i);if(r)r.count+=1;else if(l.set(i,{component:e,kind:a,attribute:s,from:n,to:o,count:1}),function(){const e=globalThis.document?.documentElement;return"warn"===e?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const t=e?`${e}: `:"",i="value"===a?`${s}="${n}"`:`${a} ${n}`;globalThis.console?.warn?.(`[SIMAI Framework] ${t}${i} is a legacy name${o?`; write ${o}`:""}. See contracts/changes/journal.json.`)}}if(s.d(a,{id:()=>r,vl:()=>m}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const e=globalThis.SF.deprecations||{};e.list=function(){return[...t().values()].map(e=>({...e}))},e.clear=function(){t().clear()},e.note=n,globalThis.SF.deprecations=e}const o=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),l=new Set;function r(e,a="field",s="1"){const t=String(e??"").trim().toLowerCase();if(o.includes(t))return t;if(Object.hasOwn(i,t)){const e=i[t];n({component:a,kind:"value",attribute:"size",from:t,to:e});const s=`${a}:${t}`;return l.has(s)||"undefined"==typeof console||(l.add(s),console.warn(`[SIMAI Framework] ${a}: size ${t} is retired for form fields; rendering size ${e}.`)),e}return s}function m(e,a){if(e?.classList)for(const[s,t]of Object.entries(i)){const t=`${a}--size-${s}`;e.classList.contains(t)&&e.classList.replace(t,`${a}--size-${r(s,a)}`)}}},"67eed2647f47"(e,a,s){s.d(a,{z:()=>o});const t=new WeakMap,n=new WeakSet;function o(e,a){const s=e.ownerDocument;n.has(s)||(s.addEventListener("reset",e=>{const a=e.target;if("FORM"!==a?.tagName)return;const s=Array.from(a.elements);setTimeout(()=>{if(!e.defaultPrevented)for(const e of s)if(e.isConnected&&e.form===a)for(const a of t.get(e)||[])a()},0)},!0),n.add(s));let o=t.get(e);return o||t.set(e,o=new Set),o.add(a),()=>o.delete(a)}},"0ab12d47912a"(e,a,s){s.d(a,{y:()=>n});let t=null;function n(){const e=()=>window.SF?.Mask?.create?window.SF.Mask:null,a=e();return a?Promise.resolve(a):t||(t=new Promise(a=>{const s=[[window,"sf-mask-ready"],[window,"sf-loader-ready"],[window,"load"],[document,"DOMContentLoaded"]],n=()=>{const o=e();o&&(s.forEach(([e,a])=>e.removeEventListener(a,n)),t=null,a(o))};s.forEach(([e,a])=>e.addEventListener(a,n))}),t)}},"58661bec99a6"(e,a,s){const t=function(e,a){if(e&&a)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(e,a);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([e,a])}}else window.registerSfComponent(e,a)};s.d(a,["A",0,t])},d7f974466839(e,a,s){s.d(a,{y:()=>t});class t{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 a=new Set;return e.forEach(e=>{if("string"!=typeof e)return;const s=e.match(/\(([^)]+)\)/g);s&&s.forEach(e=>{e.slice(1,-1).split(/\s+/).filter(Boolean).forEach(e=>{e.startsWith(".")&&e.length>1&&a.add(e.slice(1))})})}),Array.from(a)}applyLayoutUtilities(e,a){if(!e||!a)return;const s=this.getUtilityMap();if(!s||!s[a])return;this.extractUtilityClasses(s[a]).forEach(a=>e.classList.add(a))}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(){}}},"2a25b3f4fc15"(e,a,s){s.a(e,async(e,a)=>{try{var t=s("c614c5e30b0d"),n=s("0d662e4d7d63"),o=s("c0450586011d"),i=s("fbe0570fcc69"),l=s("98e26702f55a"),r=s("788779012d8a"),m=e([n,o,i,r]);[n,o,i,r]=m.then?(await m)():m;var d=s.n(i);const f=".sf-country-code",u=Array.isArray(t?.items)?t.items:[];class c extends(d()){static get props(){return{size:{default:"1"},label:{default:""},ariaLabel:{attribute:"aria-label",default:""},required:{type:Boolean,default:!1},name:{default:""},form:{default:""},hint:{default:""},value:{default:""},placeholder:{default:"+7(___)___-__-__"},disabled:{type:Boolean,default:!1},open:{type:Boolean,default:!1},locale:{default:""},useMask:{type:Boolean,default:!1},useCountryMasks:{type:Boolean,default:!0},showCode:{type:Boolean,default:!0},maskStyle:{default:"native"},multiCountry:{type:Boolean,default:!0},iso2:{default:""},dialCode:{default:""},maskPattern:{default:""},flagBase:{default:""},lazyFlags:{type:Boolean,default:!0},showMaskPlaceholder:{type:Boolean,default:!1},maskPlaceholderChar:{default:"_"},maxItems:{type:Number,default:0}}}constructor(){super(),this._countries=null,this._boundRoot=null,this._renderAttributes=new Set}get size(){return(0,l.id)(this.getAttribute("size")||"1","sf-country-code")}get label(){return this.getAttribute("label")||""}get ariaLabel(){return this.getProp("ariaLabel")||""}get required(){return this.getBooleanAttr("required",!1)}get hint(){return this.getAttribute("hint")||""}get value(){return this.getAttribute("value")||""}get placeholder(){return this.getAttribute("placeholder")||"+7(___)___-__-__"}get disabled(){return this.getBooleanAttr("disabled",!1)}get open(){return this.getBooleanAttr("open",!1)||this.getBooleanAttr("active",!1)}get locale(){return"ru"===String(this.getAttribute("locale")||(0,n.pageLanguage)(this)).toLowerCase()?"ru":"en"}get useMask(){return this.getBooleanAttr("use-mask",!1)}get useCountryMasks(){return this.getBooleanAttr("use-country-masks",!0)}get showCode(){return this.getBooleanAttr("show-code",!0)}get maskStyle(){return"brackets"===String(this.getAttribute("mask-style")||"native").toLowerCase()?"brackets":"native"}get multiCountry(){return this.getBooleanAttr("multi-country",!0)}get iso2(){return(0,o.Xx)(this.getAttribute("iso2"))}get dialCode(){return String(this.getAttribute("dial-code")||"").trim()}get maskPattern(){return String(this.getAttribute("mask-pattern")||"").trim()}get flagBase(){return String(this.getAttribute("flag-base")||"").trim()||(0,o.Dk)()}get lazyFlags(){return this.getBooleanAttr("lazy-flags",!0)}get showMaskPlaceholder(){return this.getBooleanAttr("show-mask-placeholder",!1)}get maskPlaceholderChar(){return String(this.getAttribute("mask-placeholder-char")||"_")}get maxItems(){return Math.trunc(this.getNumberAttr("max-items",0))}get countries(){return(0,o.Ue)(this._countries,this.locale,this.maxItems)}set countries(e){this._countries=Array.isArray(e)?e:null,this.requestComponentUpdate("countries")}templateContext(){const e=this.getPropsContext(),a=this._boundRoot,s=a&&!this._renderAttributes.has("open")&&!this._renderAttributes.has("active"),t=a&&!this._renderAttributes.has("disabled");return this.createTemplateContext({...e,open:s?a.classList.contains("open"):this.open,disabled:t?!!a.querySelector("input")?.disabled||a.classList.contains("disabled"):this.disabled,countries:this.countries.length?this.countries:(0,o.Ue)(u,this.locale,this.maxItems),locale:this.locale,maskStyle:this.maskStyle,iso2:this.iso2,flagBase:this.flagBase,maxItems:this.maxItems})}onDisconnected(){this._boundRoot&&((0,o._i)(this._boundRoot),this._boundRoot=null)}beforeRender(e=[]){this._renderAttributes=new Set(e)}afterRender(e){if("function"==typeof e)return super.afterRender(e);this._boundRoot&&((0,o._i)(this._boundRoot),this._boundRoot=null),this._boundRoot=this.querySelector(f),this._boundRoot&&(0,o.nD)(this._boundRoot,{resetCountry:this._renderAttributes.has("iso2")||this._renderAttributes.has("dial-code"),countries:this.countries,maskPattern:this.maskPattern})}template(){return(0,r.o)(this.templateContext())}get state(){const e=this.querySelector(f),a=e?.querySelector?.(".sf-country-code-field input")||null;return{value:a?.value||"",iso2:e?.dataset?.iso2||"",dialCode:e?.dataset?.dialCode||"",open:e?.classList?.contains("open")||!1,disabled:e?.classList?.contains("disabled")||!1}}setState(e={}){const a=this.querySelector(f);return(0,o.nK)(a,e)}}c.define("sf-country-code"),a()}catch(e){a(e)}})},"788779012d8a"(e,a,s){s.a(e,async(e,t)=>{try{s.d(a,{o:()=>r});var n=s("ddf1cdb42ecc"),o=e([n]),i=o.then?(await o)():o;n=i[0];function l(e,a=""){const s=String(e?.iso2||"").trim().toLowerCase(),t=e?.flagEmoji||"",o=s&&a?`${a}/${s}.svg`:"";return o?n.html`
1
+ (()=>{"use strict";var e={c0450586011d(e,a,s){s.a(e,async(e,t)=>{try{s.d(a,{Dk:()=>I,Ue:()=>Y,Xx:()=>T,_i:()=>he,nD:()=>ce,nK:()=>ye});var n=s("d7f974466839"),o=s("58661bec99a6"),i=s("8c672a55a76a"),l=s("c614c5e30b0d"),r=s("67eed2647f47"),m=s("0ab12d47912a"),d=s("5c1dc214bb5e"),f=s("98e26702f55a"),u=s("0d662e4d7d63"),c=s("421676f72963"),h=e([d,u]);[d,u]=h.then?(await h)():h;var k=s.n(d);const y={en:{phoneLabel:"Phone number",phoneRequired:"Enter a phone number.",countryLabel:"Country code"},ru:{phoneLabel:"Телефон",phoneRequired:"Введите номер телефона.",countryLabel:"Код страны"}},p=()=>globalThis.SF?.Position||k(),H=".sf-country-code",g="sfCountryCodeBound",E=Array.isArray(l?.items)?l.items:[];let P=null,C=0;const b=new WeakMap,R=new WeakMap,j=new WeakMap,w=new WeakMap,x=new WeakMap;function S(e,a){if(!a)return;const s=w.get(a)||{},t=e.querySelector(".sf-country-code-text"),n=e.querySelector(".sf-country-code-hint"),o=b.get(a),i=a.hasAttribute("aria-label")&&a.getAttribute("aria-label")!==o;for(const[e,o]of[["aria-labelledby",t],["aria-describedby",n]]){const t=o?.textContent.trim()?o:null;let n=(a.getAttribute(e)||"").split(/\s+/).filter(Boolean);const l=o&&/^sf-country-\d+$/.test(o.id)&&n.includes(o.id)?o.id:"",r=s[e]||l;n=n.filter(e=>e!==r);const m=t&&("aria-describedby"===e||!i&&0===n.length)?v(t):"";m&&n.push(m);const d=[...new Set(n)].join(" ");d!==(a.getAttribute(e)||"")&&(d?a.setAttribute(e,d):a.removeAttribute(e)),s[e]=m}if(w.set(a,s),t?.textContent.trim()||a.hasAttribute("aria-labelledby"))o&&a.getAttribute("aria-label")===o&&a.removeAttribute("aria-label");else if(!i){const s=(0,u.pageText)(y,"phoneLabel",e,"sf-country-code");a.getAttribute("aria-label")!==s&&a.setAttribute("aria-label",s),b.set(a,s)}}function _(e,a){const s=j.get(a);if(a.validity.customError&&a.validationMessage!==s)return;const t=e.__sfCountryConfig||{},n=String(a.value||"").trim(),o=t.showCode?U(n,e.dataset.dialCode):n,i=a.required&&""!==n&&!/\d/.test(o)?(0,u.pageText)(y,"phoneRequired",e,"sf-country-code"):"";a.setCustomValidity(i),j.set(a,i)}function v(e){if(!e)return"";if(!e.id||document.getElementById(e.id)&&document.getElementById(e.id)!==e)do{e.id="sf-country-"+ ++C}while(document.getElementById(e.id)&&document.getElementById(e.id)!==e);return e.id}function M(e,a){if(!e||e.hasAttribute("aria-labelledby"))return;const s=b.get(e);e.hasAttribute("aria-label")&&e.getAttribute("aria-label")!==s||(e.setAttribute("aria-label",a),b.set(e,a))}function L(e){const{input:a,toggle:s,list:t,items:n}=O(e),o=e.__sfCountryConfig||{},i=e.classList.contains("open"),l=e.__sfCountrySelected,r=(0,u.pageText)(y,"countryLabel",e,"sf-country-code");S(e,a),e.querySelectorAll(".sf-country-code-required, .sf-country-code-left .sf-icon").forEach(e=>e.setAttribute("aria-hidden","true")),s&&(o.multiCountry&&o.showCode&&t?(M(s,`${r}${l?`: ${J(l,o.locale)}`:""}`),s.setAttribute("role","button"),s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-controls",v(t)),s.setAttribute("aria-expanded",String(i))):(s.removeAttribute("aria-haspopup"),s.removeAttribute("aria-controls"),s.removeAttribute("aria-expanded"),s.removeAttribute("aria-disabled"),s.removeAttribute("role"),s.getAttribute("aria-label")===b.get(s)&&(s.removeAttribute("aria-label"),b.delete(s)),s.tabIndex=-1)),t&&(t.setAttribute("role","listbox"),M(t,r),t.setAttribute("aria-hidden",String(!i)),t.inert=!i);let m=!1;for(const e of n){const a=!m&&!!l&&(l.iso2?T(e.dataset.iso2)===l.iso2:e.dataset.code===l.dialCode);m||=a,e.setAttribute("role","option"),e.setAttribute("aria-selected",String(a)),e.tabIndex=i&&e===document.activeElement?0:-1}}function A(e,a=!1){return null==e||""===e?a:"boolean"==typeof e?e:["1","true","yes","on","active","open","disabled"].includes(String(e).toLowerCase())}function T(e){return String(e||"").trim().toUpperCase()}function I(){const e="undefined"!=typeof window?window.sfPath:"";if(!e)return"";try{return new URL("component/flag/flags/rect",e).href.replace(/\/$/,"")}catch{return String(e).replace(/\/$/,"")+"/component/flag/flags/rect"}}function B(e,a){const s=T(e).toLowerCase();return s&&a?`${a}/${s}.svg`:""}function $(e){if(!e||"1"===e.dataset.loaded)return;const a=e.dataset.flagSrc||"";a&&(e.src=a,e.dataset.loaded="1")}function F(e,a=!0){if(!e)return;if(!a)return void $(e);const s=(P||!("IntersectionObserver"in window)||(P=new IntersectionObserver(e=>{e.forEach(e=>{if(!e.isIntersecting)return;const a=e.target;$(a),P?.unobserve?.(a)})},{rootMargin:"120px"})),P);s?s.observe(e):$(e)}function N(e,a,s=!0){const t=document.createElement("div");t.classList.add("sf-country-code-flag"),t.setAttribute("aria-hidden","true");const n=e?.flagEmoji||"",o=B(e?.iso2,a.flagBase);if(!o)return t.textContent=n,t;const i=document.createElement("img");return i.alt=e?.iso2?`${e.iso2} flag`:"flag",i.decoding="async",i.loading="lazy",i.dataset.flagSrc=o,i.dataset.flagFallback=n,i.addEventListener("error",()=>{t.textContent=n},{once:!0}),F(i,s&&a.lazyFlags),t.append(i),t}function O(e){return{input:e?.querySelector?.(".sf-country-code-field input")||null,toggle:e?.querySelector?.(".sf-country-code-left")||null,list:e?.querySelector?.(".sf-country-code-list")||null,itemsWrap:e?.querySelector?.(".sf-country-code-items")||null,items:Array.from(e?.querySelectorAll?.(".sf-country-code-item")||[]),leftFlag:e?.querySelector?.(".sf-country-code-left .sf-country-code-flag-icon")||e?.querySelector?.(".sf-country-code-left .sf-country-code-flag")||null}}function D(e){const a=T(e);return a&&E.find(e=>e.iso2===a)||null}function q(e){const a=String(e||"").trim();return a&&E.find(e=>e.dialCode===a)||null}function z(e,a="native"){const s=String(e||"").trim();if(!s)return s;if("brackets"!==a)return s;const t=s.replace(/[()]/g,""),n=t.match(/^(\+\S+)\s+(.+)$/);if(!n)return t;const o=n[1],i=n[2].trim();if(!i)return t;const l=i.indexOf(" ");let r=l>=0?i.slice(0,l):i,m=l>=0?i.slice(l+1).trim():"",d=r;if(r.includes("-")){const[e,...a]=r.split("-");d=e;m=[a.join("-"),m].filter(Boolean).join(" ")}return d?`${o} (${d})${m?` ${m}`:""}`.trim():t}function G(e,a,s=""){const t=String(e||"");if(!t)return"";const n=a||"_",o=String(s||"").replace(/\D/g,"");let i=0;return t.replace(/0/g,()=>{if(i<o.length){const e=o[i];return i+=1,e}return n})}function K(e){return String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function U(e,a){const s=String(e||"").trim();if(!s)return"";if(a){const e=K(a.trim()),t=new RegExp(`^${e}[\\s\\-()]*`,"i"),n=s.replace(t,"").trim();if(n!==s)return n}return s.replace(/^\+\d+[\s\-()]*/,"").trim()}function W(e=null){document.querySelectorAll(H).forEach(a=>{e&&a===e||V(a,!1)})}function V(e,a){if(!e)return;const{input:s}=O(e);(s?.disabled||e.classList.contains("disabled")||!1===e.__sfCountryConfig?.multiCountry)&&(a=!1),a?e.classList.add("open"):e.classList.remove("open"),(0,c.Ec)(e,a),L(e),e.__sfCountryViewport?.(a)}function Z(e,a){const s=String(e.dataset.locale||a?.dataset.locale||(0,u.pageLanguage)(e)).toLowerCase(),t="brackets"===String(e.dataset.maskStyle??a?.dataset.maskStyle??"native").toLowerCase()?"brackets":"native";return{locale:"ru"===s?"ru":"en",useMask:A(e.dataset.useMask??a?.dataset.useMask,!1),useCountryMasks:A(e.dataset.useCountryMasks??a?.dataset.useCountryMasks,!0),showCode:A(e.dataset.showCode??a?.dataset.showCode,!0),maskStyle:t,multiCountry:A(e.dataset.multiCountry??a?.dataset.multiCountry,!0),defaultIso2:T(e.dataset.iso2??a?.dataset.iso2),fixedDialCode:String(e.dataset.dialCode??a?.dataset.dialCode??"").trim(),fixedMaskPattern:String(e.dataset.maskPattern??a?.dataset.maskPattern??"").trim(),flagBase:String(e.dataset.flagBase||a?.dataset.flagBase||"").trim()||I(),lazyFlags:A(e.dataset.lazyFlags??a?.dataset.lazyFlags,!0),showMaskPlaceholder:A(e.dataset.showMaskPlaceholder??a?.dataset.showMaskPlaceholder,!1),maskPlaceholderChar:String(e.dataset.maskPlaceholderChar??a?.dataset.maskPlaceholderChar??"_"),maxItems:Number.parseInt(e.dataset.maxItems||a?.dataset.maxItems||"0",10)||0}}function J(e,a){if(!e)return"";if(e.label)return String(e.label);const s=("en"===a?e.nameEn||e.nameRu:e.nameRu||e.nameEn)||e.iso2;return s?`${s} (${e.dialCode})`:String(e.dialCode||"")}function Y(e,a="ru",s=0){let t=Array.isArray(e)&&e.length?e:E;return Number(s)>0&&(t=t.slice(0,Number(s))),t.filter(e=>e&&"object"==typeof e).map(e=>{const s=T(e.iso2),t=String(e.dialCode||e.code||"").trim(),n=D(s)||!s&&q(t)||{},o={...n,...e,iso2:s||n.iso2||"",dialCode:t||n.dialCode||""};return o.label=J(o,a),o})}function X(e,a){const s=e.cloneNode(!0);return s.querySelectorAll('.sf-country-code-flag, [aria-hidden="true"]').forEach(e=>e.remove()),Y([{iso2:e.dataset.iso2,code:e.dataset.code,label:s.textContent.trim(),...e.hasAttribute("data-mask-pattern")?{maskPattern:e.dataset.maskPattern}:{}}],a)[0]}function Q(e,a="",s=""){const t=e.__sfCountryOptions||[],n=T(a),o=String(s||"").trim();return n&&t.find(e=>e.iso2===n)||o&&t.find(e=>e.dialCode===o)||D(n)||q(o)}function ee(e,a){const{list:s,itemsWrap:t}=O(e);if(s&&t)return{list:s,itemsWrap:t};const n=document.createElement("span");n.classList.add("sf-country-code-list");const o=document.createElement("span");o.classList.add("sf-country-code-items","flex","flex-col"),n.append(o);const i=e.querySelector(".sf-country-code-field");return i?i.insertAdjacentElement("afterend",n):e.append(n),a.multiCountry||n.classList.add("hidden"),{list:n,itemsWrap:o}}function ae(e,a){if(!a.multiCountry)return;const{itemsWrap:s}=ee(e,a);if(!s)return;if(s.children.length>0)return;const t=a.maxItems>0?E.slice(0,a.maxItems):E,n=document.createDocumentFragment();t.forEach(e=>{const s=document.createElement("span");s.classList.add("sf-country-code-item","flex","items-center","transition"),s.dataset.iso2=e.iso2,s.dataset.code=e.dialCode,e.maskPattern&&(s.dataset.maskPattern=e.maskPattern);const t=N(e,a,!0),o=document.createElement("span");o.textContent=J(e,a.locale),s.append(t,o),n.append(s)}),s.append(n)}function se(e){const{list:a}=O(e);a&&a.querySelectorAll("img[data-flag-src]").forEach(e=>F(e,!0))}function te(e,a=8){const{list:s,itemsWrap:t}=O(e);if(!s||!t||a<=0||!e.classList.contains("open"))return 0;const n=Array.from(t.querySelectorAll(".sf-country-code-item")).slice(0,a),o=n.map(e=>e.offsetHeight);if(!o.some(Boolean))return 0;const i=window.getComputedStyle(t),l=Number.parseFloat(i.rowGap||"")||Number.parseFloat(i.gap||"")||0,r=o.reduce((e,a)=>e+a,0)+(n.length-1)*l+(Number.parseFloat(i.paddingTop||"")||0)+(Number.parseFloat(i.paddingBottom||"")||0);return Object.assign(t.style,{maxHeight:`${r}px`,minHeight:"0",overflowY:"auto",overflowX:"hidden"}),r}function ne(e){const{list:a,itemsWrap:s}=O(e);if(!a||!s)return;let t=null,n=null;e.__sfCountryViewport=s=>{if(s&&!t&&e.isConnected)n=["display","flex-direction","overflow"].map(e=>[e,a.style.getPropertyValue(e),a.style.getPropertyPriority(e)]),Object.assign(a.style,{display:"flex",flexDirection:"column",overflow:"hidden"}),te(e),t=p().anchor(e,a,{side:"block-end",align:"start",matchWidth:!0,fitHeight:!0,onPosition:()=>{const a=e.getBoundingClientRect();(a.bottom<=0||a.top>=window.innerHeight)&&V(e,!1)}});else if(!s&&t){t.stop(),t=null;for(const[e,s,t]of n)s?a.style.setProperty(e,s,t):a.style.removeProperty(e)}else s&&t&&(te(e),t.update())}}function oe(e,a){for(let s=e;s;s=Object.getPrototypeOf(s)){const e=Object.getOwnPropertyDescriptor(s,a);if(e)return"function"==typeof e.set||!0===e.writable}return!1}async function ie(e,a,s,t=null){if(!a)return;const n=Symbol("country-code-mask");if(e.__sfCountryMaskToken=n,e.__sfCountryMask&&(window.SF?.Mask?.destroy?.(e.__sfCountryMask),delete e.__sfCountryMask),!s)return;const o=await(0,m.y)();if(n!==e.__sfCountryMaskToken)return;const i=a.value;try{const l=t||e.__sfCountryConfig||Z(e,a),r=""!==String(i||"").trim(),m=l.showMaskPlaceholder&&r;if(!r&&s){const t=e?.dataset?.dialCode||l.fixedDialCode||"";a.placeholder=G(s,l.maskPlaceholderChar||"_",t)}const d=await o.create(a,{mask:s,lazy:!m,placeholderChar:l.maskPlaceholderChar||"_"});if(!d||n!==e.__sfCountryMaskToken)return void window.SF?.Mask?.destroy?.(d);if(e.__sfCountryMask=d,i){const e=String(i).replace(/\D+/g,"");e&&oe(d,"unmaskedValue")?d.unmaskedValue=e:oe(d,"value")&&(d.value=String(i)),"function"==typeof d.updateValue&&d.updateValue(),a.value=d.value||a.value}_(e,a)}catch(e){console.warn("SF.CountryCode mask init failed",e)}}function le(e,a){return Q(a,e.defaultIso2)||Q(a,"",e.fixedDialCode)||a.__sfCountryOptions?.[0]||E[0]||null}function re(e){const{input:a,toggle:s}=O(e);if(!a)return;const t=e.classList.contains("disabled"),n=A(a.disabled,!1),o=t||n;e.classList.toggle("disabled",o),s&&(s.setAttribute("aria-disabled",o?"true":"false"),s.tabIndex=o?-1:0),o&&V(e,!1),L(e)}function me(e,a){if(!a?.showCode)return"";const s=String(e?.dataset?.dialCode||"").trim();return s?`${s} `:""}function de(e,a,s){if(!a)return;const t=me(e,s);if(!t)return;const n=String(a.value||"");if(n.startsWith(t))return;const o=U(n,e?.dataset?.dialCode||"");a.value=`${t}${o}`.trimEnd()}function fe(e,a){if(!e||!a)return;const s=e.selectionStart??0,t=e.selectionEnd??0;if(s>=a.length&&t>=a.length)return;const n=a.length;e.setSelectionRange(n,n)}function ue(e,a,s="runtime"){if(!e||!a)return;const{input:t,leftFlag:n}=O(e);if(!t)return;const o=e.__sfCountryConfig||Z(e,t),i=e.dataset.dialCode||"";e.dataset.iso2=a.iso2,e.dataset.dialCode=a.dialCode,e.dataset.maskPattern=a.maskPattern||"";const l=x.get(e);if(l&&(l.selected=e.dataset.maskPattern),e.__sfCountrySelected=a,o.showCode&&n){const e=N(a,o,!1),s=e.querySelector("img");n.textContent="",s?n.append(s):n.textContent=e.textContent||""}if("item"===s||"state"===s){const s=U(t.value,i);ie(e,t,"",o);const n=a.dialCode?`${a.dialCode} `:"";t.value=`${n}${s}`.trim(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}if(o.useMask){ie(e,t,z(o.useCountryMasks?a.maskPattern:o.fixedMaskPattern||a.maskPattern,o.maskStyle),o)}else ie(e,t,"",o);L(e),_(e,t)}function ce(e,{resetCountry:a=!1,countries:s,maskPattern:t}={}){if((0,f.vl)(e,"sf-country-code"),e?.__sfCountryCodeBind&&e.__sfCountryCodeBind!==ce)return e.__sfCountryCodeBind(e,{resetCountry:a,countries:s,maskPattern:t});if(!e||"function"==typeof e.__sfCountryCodeInput)return;const{input:n,toggle:o,leftFlag:i}=O(e);if(!n)return;e.__sfCountryCodeBind=ce,e.__sfCountryCodeSetState=ye;const l=Z(e,n),m=x.get(e),d=void 0!==t?String(t).trim():m&&l.fixedMaskPattern===m.selected?m.fixed:l.fixedMaskPattern;l.fixedMaskPattern=d,x.set(e,{fixed:d,selected:e.dataset.maskPattern}),e.__sfCountryConfig=l,ae(e,l),te(e,8);const u=O(e),c=u.items;if(ne(e),e.__sfCountryOptions=void 0===s?c.map(e=>X(e,l.locale)):Y(s,l.locale,l.maxItems),!l.showCode&&o?o.classList.add("hidden"):o&&o.classList.remove("hidden"),l.multiCountry)e.classList.remove("sf-country-code--fixed-dial-code"),u.list?.classList?.remove("hidden");else{e.classList.add("sf-country-code--fixed-dial-code"),e.classList.remove("open"),u.list?.classList?.add("hidden");const a=o?.querySelector?.(".sf-icon");a&&a.remove()}const h=le(l,e);!a&&R.has(n)||R.set(n,h),h?ue(e,h,"init"):i&&(i.textContent="");const k=a=>{if(a.preventDefault(),!l.multiCountry||n.disabled||e.classList.contains("disabled"))return;const s=!e.classList.contains("open");W(e),V(e,s),s&&se(e)},y=a=>{a.altKey||a.ctrlKey||a.metaKey||n.disabled||e.classList.contains("disabled")||!l.multiCountry||("Enter"!==a.key&&" "!==a.key||(a.preventDefault(),k(a),e.classList.contains("open")&&P()),"ArrowDown"!==a.key&&"ArrowUp"!==a.key||(a.preventDefault(),e.classList.contains("open")||k(a),P("ArrowUp"===a.key?-1:void 0)),"Escape"===a.key&&e.classList.contains("open")&&(a.preventDefault(),a.stopPropagation(),V(e,!1)))},p=a=>{e.contains(a.target)||V(e,!1)},H=a=>{if(a.preventDefault(),n.disabled||e.classList.contains("disabled")||!l.multiCountry)return;const s=a.currentTarget;if("true"===s.getAttribute("aria-disabled")||s.classList.contains("disabled"))return;const t=X(s,l.locale);t&&(ue(e,t,"item"),V(e,!1),("keydown"===a.type?o:n)?.focus({preventScroll:!0}))},E=()=>c.filter(e=>"true"!==e.getAttribute("aria-disabled")&&!e.classList.contains("disabled")&&!e.hidden),P=e=>{const a=E(),s=a.findIndex(e=>"true"===e.getAttribute("aria-selected")),t=void 0===e?Math.max(0,s):e<0?a.length-1:Math.min(e,a.length-1);c.forEach(e=>{e.tabIndex=-1});const n=a[t];if(!n)return;n.tabIndex=0,n.focus({preventScroll:!0});const o=u.itemsWrap;if(o){const e=o.getBoundingClientRect(),a=n.getBoundingClientRect();a.top<e.top?o.scrollTo({top:o.scrollTop-(e.top-a.top),behavior:"instant"}):a.bottom>e.bottom&&o.scrollTo({top:o.scrollTop+(a.bottom-e.bottom),behavior:"instant"})}};let C="",b=0;const j=a=>{if(a.altKey||a.ctrlKey||a.metaKey||n.disabled||e.classList.contains("disabled"))return;const s=E(),t=s.indexOf(a.currentTarget);if("Escape"===a.key)return a.preventDefault(),a.stopPropagation(),V(e,!1),void o?.focus({preventScroll:!0});if("Enter"!==a.key&&" "!==a.key){if(["ArrowDown","ArrowUp","Home","End"].includes(a.key)){a.preventDefault();const e="Home"===a.key?0:"End"===a.key?s.length-1:Math.max(0,t+("ArrowDown"===a.key?1:-1));return void P(e)}if(1===a.key.length){const e=performance.now();C=e-b>700?a.key:C+a.key,b=e;const n=[...C].every(e=>e===C[0])?C[0]:C,o=[...s.slice(t+1),...s.slice(0,t+1)].find(e=>(e.querySelector("span")?.textContent||e.textContent).trim().toLocaleLowerCase().startsWith(n.toLocaleLowerCase()));o&&(a.preventDefault(),P(s.indexOf(o)))}}else H(a)},w=a=>{e.contains(a.relatedTarget)||V(e,!1)},v=()=>{de(e,n,l),fe(n,me(e,l)),_(e,n)},M=()=>{requestAnimationFrame(()=>{de(e,n,l),fe(n,me(e,l))})},L=a=>{const s=me(e,l);if(!s)return;if(!["Backspace","Delete"].includes(a.key))return;const t=n.selectionStart??0,o=n.selectionEnd??t;return"Backspace"===a.key&&t<=s.length||"Delete"===a.key&&t<s.length?(a.preventDefault(),void fe(n,s)):void((t<s.length||o<s.length)&&(a.preventDefault(),fe(n,s)))};o&&(o.addEventListener("click",k),o.addEventListener("keydown",y),o.setAttribute("role","button")),n.addEventListener("input",v),n.addEventListener("paste",M),n.addEventListener("keydown",L),c.forEach(e=>{e.addEventListener("click",H),e.addEventListener("keydown",j)}),e.addEventListener("focusout",w),document.addEventListener("click",p),e.__sfCountryCodeToggleClick=k,e.__sfCountryCodeToggleKeydown=y,e.__sfCountryCodeDocClick=p,e.__sfCountryCodeItemClick=H,e.__sfCountryCodeItemKeydown=j,e.__sfCountryCodeFocusOut=w,e.__sfCountryCodeInput=v,e.__sfCountryCodePaste=M,e.__sfCountryCodeInputKeydown=L,e.__sfCountryReleaseReset=(0,r.z)(n,()=>{const a=R.get(n);a&&ue(e,a,"reset"),V(e,!1),_(e,n)}),e.__sfCountryRequiredObserver=new MutationObserver(()=>{_(e,n),S(e,n)}),e.__sfCountryRequiredObserver.observe(e,{attributes:!0,attributeFilter:["required","aria-label","aria-labelledby","aria-describedby","id"],childList:!0,characterData:!0,subtree:!0}),e.dataset[g]="1",re(e),e.__sfCountryViewport?.(e.classList.contains("open"))}function he(e){if(!e||"function"!=typeof e.__sfCountryCodeInput)return;const{input:a,toggle:s,items:t}=O(e);e.__sfCountryReleaseReset?.(),delete e.__sfCountryReleaseReset,e.__sfCountryRequiredObserver?.disconnect(),delete e.__sfCountryRequiredObserver,e.__sfCountryViewport?.(!1),delete e.__sfCountryViewport,(0,c.Ec)(e,!1),e.querySelectorAll("img[data-flag-src]").forEach(e=>P?.unobserve(e)),s&&e.__sfCountryCodeToggleClick&&s.removeEventListener("click",e.__sfCountryCodeToggleClick),s&&e.__sfCountryCodeToggleKeydown&&s.removeEventListener("keydown",e.__sfCountryCodeToggleKeydown),e.__sfCountryCodeDocClick&&document.removeEventListener("click",e.__sfCountryCodeDocClick),t.forEach(a=>{e.__sfCountryCodeItemKeydown&&a.removeEventListener("keydown",e.__sfCountryCodeItemKeydown),e.__sfCountryCodeItemClick&&a.removeEventListener("click",e.__sfCountryCodeItemClick)}),e.__sfCountryCodeFocusOut&&e.removeEventListener("focusout",e.__sfCountryCodeFocusOut),a&&e.__sfCountryCodeInput&&a.removeEventListener("input",e.__sfCountryCodeInput),a&&e.__sfCountryCodePaste&&a.removeEventListener("paste",e.__sfCountryCodePaste),a&&e.__sfCountryCodeInputKeydown&&a.removeEventListener("keydown",e.__sfCountryCodeInputKeydown),e.__sfCountryMask&&window.SF?.Mask?.destroy?.(e.__sfCountryMask),delete e.__sfCountryCodeToggleClick,delete e.__sfCountryCodeToggleKeydown,delete e.__sfCountryCodeDocClick,delete e.__sfCountryCodeItemClick,delete e.__sfCountryCodeItemKeydown,delete e.__sfCountryCodeFocusOut,delete e.__sfCountryCodeInput,delete e.__sfCountryCodePaste,delete e.__sfCountryCodeInputKeydown,delete e.__sfCountryMask,delete e.__sfCountryMaskToken,delete e.__sfCountrySelected,delete e.__sfCountryConfig,delete e.__sfCountryOptions,delete e.dataset[g]}function ke(e=document){e.querySelectorAll(H).forEach(e=>{e.closest("sf-country-code")||ce(e)})}function ye(e,a={}){const s=e instanceof HTMLElement?e.closest(H)||e:null;if(!s)return!1;if(s.__sfCountryCodeSetState&&s.__sfCountryCodeSetState!==ye)return s.__sfCountryCodeSetState(s,a);const{input:t}=O(s);if(!t)return!1;if(Object.prototype.hasOwnProperty.call(a,"disabled")){const e=A(a.disabled,!1);t.disabled=e,s.classList.toggle("disabled",e),re(s)}if(Object.prototype.hasOwnProperty.call(a,"active")&&V(s,A(a.active,!1)),Object.prototype.hasOwnProperty.call(a,"open")&&V(s,A(a.open,!1)),Object.prototype.hasOwnProperty.call(a,"value")&&(t.value=String(a.value??""),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))),Object.prototype.hasOwnProperty.call(a,"iso2")){const e=Q(s,a.iso2);e&&ue(s,e,"state")}if(Object.prototype.hasOwnProperty.call(a,"dialCode")){const e=Q(s,"",a.dialCode);e&&ue(s,e,"state")}return!0}class pe extends n.y{static componentName="CountryCode";html=null;constructor(e){super(e);const{size:a="1",label:s="",required:t=!1,name:n="",form:o="",hint:i="",value:l="",placeholder:r="+7(___)___-__-__",disabled:m=!1,active:d=!1,open:u=d,countries:c=[],locale:h="ru",useMask:k=!1,useCountryMasks:y=!0,showCode:p=!0,maskStyle:H="native",multiCountry:g=!0,iso2:E="",dialCode:P="",maskPattern:C="",flagBase:b="",lazyFlags:R=!0,showMaskPlaceholder:j=!1,maskPlaceholderChar:w="_",maxItems:x=0}=this.params||{},S=this.attrs.class||this.attrs.className;this.template=document.createElement("label"),this.id&&(this.template.id=this.id),this.template.classList.add("sf-country-code",`sf-country-code--size-${(0,f.id)(a,"sf-country-code")}`),A(m)&&this.template.classList.add("disabled"),A(u)&&this.template.classList.add("open"),S&&this.template.classList.add(...`${S}`.split(" ").filter(Boolean)),this.template.dataset.locale=String(h),this.template.dataset.useMask=String(A(k,!1)),this.template.dataset.useCountryMasks=String(A(y,!0)),this.template.dataset.showCode=String(A(p,!0)),this.template.dataset.maskStyle="brackets"===String(H).toLowerCase()?"brackets":"native",this.template.dataset.multiCountry=String(A(g,!0)),this.template.dataset.lazyFlags=String(A(R,!0)),this.template.dataset.showMaskPlaceholder=String(A(j,!1)),this.template.dataset.maskPlaceholderChar=String(w||"_"),E&&(this.template.dataset.iso2=T(E)),P&&(this.template.dataset.dialCode=String(P)),C&&(this.template.dataset.maskPattern=String(C)),b&&(this.template.dataset.flagBase=String(b).replace(/\/$/,"")),Number(x)>0&&(this.template.dataset.maxItems=String(Number(x)));const _=document.createElement("span");_.classList.add("sf-country-code-label");const v=document.createElement("span");if(v.classList.add("sf-country-code-text"),v.textContent=String(s),_.append(v),A(t,!1)){const e=document.createElement("span");e.classList.add("sf-country-code-required"),e.textContent="*",_.append(e)}const M=document.createElement("span");M.classList.add("sf-country-code-field");const L=document.createElement("span");L.classList.add("sf-country-code-left");const B=document.createElement("div");B.classList.add("sf-country-code-flag-icon"),B.setAttribute("aria-hidden","true");const $=document.createElement("i");$.classList.add("sf-icon"),$.textContent=A(u)?"expand_less":"expand_more",L.append(B,$);const F=document.createElement("input");F.type="tel",F.name=String(n),o&&F.setAttribute("form",String(o)),F.required=A(t,!1),F.defaultValue=String(l??""),F.placeholder=String(r??""),F.disabled=A(m,!1),M.append(L,F),this.template.append(_,M);const O=Y(c,h,x);if(O.length){const e=document.createElement("span");e.classList.add("sf-country-code-list");const a=document.createElement("span");a.classList.add("sf-country-code-items","flex","flex-col"),O.forEach(e=>{const s=document.createElement("span");s.classList.add("sf-country-code-item"),e?.iso2&&(s.dataset.iso2=T(e.iso2)),(e?.dialCode||e?.code)&&(s.dataset.code=String(e.dialCode||e.code)),void 0!==e?.maskPattern&&(s.dataset.maskPattern=String(e.maskPattern||""));const t=N({iso2:e?.iso2,flagEmoji:e?.flagEmoji||""},{flagBase:this.template.dataset.flagBase||I(),lazyFlags:A(this.template.dataset.lazyFlags,!0)},!0),n=document.createElement("span");if(e?.label)n.textContent=String(e.label);else{const a=e?.nameRu||e?.nameEn||e?.dialCode||"",s=e?.dialCode||e?.code||"";n.textContent=s?`${a} (${s})`:a}s.append(t,n),this.applyLayoutUtilities(s,".sf-country-code .sf-country-code-item"),this.applyLayoutUtilities(t,".sf-country-code .sf-country-code-flag"),a.append(s)}),e.append(a),this.template.append(e)}if(i){const e=document.createElement("span");e.classList.add("sf-country-code-hint"),e.textContent=String(i),this.template.append(e)}this.applyLayoutUtilities(this.template,".sf-country-code"),this.applyLayoutUtilities(_,".sf-country-code .sf-country-code-label"),this.applyLayoutUtilities(M,".sf-country-code .sf-country-code-field"),this.applyLayoutUtilities(L,".sf-country-code .sf-country-code-left"),this.applyLayoutUtilities(F,".sf-country-code .sf-country-code-field input"),this.applyLayoutUtilities(B,".sf-country-code .sf-country-code-flag-icon")}init(){ce(this.template,{maskPattern:this.params?.maskPattern||""})}destroyInternal(){he(this.template)}}pe.utilityMap=i,(0,o.A)("CountryCode",pe),"undefined"!=typeof window&&(window.SF=window.SF||{},window.SF.CountryCode=window.SF.CountryCode||{},window.SF.CountryCode.setState=ye),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>ke()):ke();new MutationObserver(e=>{e.forEach(e=>{e.removedNodes.forEach(e=>{if(!(e instanceof Element))return;const a=[...e.querySelectorAll(H)];e.matches(H)&&a.unshift(e);for(const e of a)e.isConnected||e.closest("sf-country-code")||he(e)}),e.addedNodes.forEach(e=>{e instanceof Element&&(e.matches?.(H)&&!e.closest("sf-country-code")&&ce(e),ke(e))})})}).observe(document.documentElement,{childList:!0,subtree:!0}),t()}catch(He){t(He)}})},"98e26702f55a"(e,a,s){function t(){const e=globalThis.SF=globalThis.SF||{};return e.__deprecationNotes instanceof Map||Object.defineProperty(e,"__deprecationNotes",{value:new Map,configurable:!0}),e.__deprecationNotes}function n({component:e="",kind:a="attribute",attribute:s="",from:n,to:o=null}={}){if(!n)return;const i=[e,a,s,n].join("|"),l=t(),r=l.get(i);if(r)r.count+=1;else if(l.set(i,{component:e,kind:a,attribute:s,from:n,to:o,count:1}),function(){const e=globalThis.document?.documentElement;return"warn"===e?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const t=e?`${e}: `:"",i="value"===a?`${s}="${n}"`:`${a} ${n}`;globalThis.console?.warn?.(`[SIMAI Framework] ${t}${i} is a legacy name${o?`; write ${o}`:""}. See contracts/changes/journal.json.`)}}if(s.d(a,{id:()=>r,vl:()=>m}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const e=globalThis.SF.deprecations||{};e.list=function(){return[...t().values()].map(e=>({...e}))},e.clear=function(){t().clear()},e.note=n,globalThis.SF.deprecations=e}const o=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),l=new Set;function r(e,a="field",s="1"){const t=String(e??"").trim().toLowerCase();if(o.includes(t))return t;if(Object.hasOwn(i,t)){const e=i[t];n({component:a,kind:"value",attribute:"size",from:t,to:e});const s=`${a}:${t}`;return l.has(s)||"undefined"==typeof console||(l.add(s),console.warn(`[SIMAI Framework] ${a}: size ${t} is retired for form fields; rendering size ${e}.`)),e}return s}function m(e,a){if(e?.classList)for(const[s,t]of Object.entries(i)){const t=`${a}--size-${s}`;e.classList.contains(t)&&e.classList.replace(t,`${a}--size-${r(s,a)}`)}}},"67eed2647f47"(e,a,s){s.d(a,{z:()=>o});const t=new WeakMap,n=new WeakSet;function o(e,a){const s=e.ownerDocument;n.has(s)||(s.addEventListener("reset",e=>{const a=e.target;if("FORM"!==a?.tagName)return;const s=Array.from(a.elements);setTimeout(()=>{if(!e.defaultPrevented)for(const e of s)if(e.isConnected&&e.form===a)for(const a of t.get(e)||[])a()},0)},!0),n.add(s));let o=t.get(e);return o||t.set(e,o=new Set),o.add(a),()=>o.delete(a)}},"0ab12d47912a"(e,a,s){s.d(a,{y:()=>n});let t=null;function n(){const e=()=>window.SF?.Mask?.create?window.SF.Mask:null,a=e();return a?Promise.resolve(a):t||(t=new Promise(a=>{const s=[[window,"sf-mask-ready"],[window,"sf-loader-ready"],[window,"load"],[document,"DOMContentLoaded"]],n=()=>{const o=e();o&&(s.forEach(([e,a])=>e.removeEventListener(a,n)),t=null,a(o))};s.forEach(([e,a])=>e.addEventListener(a,n))}),t)}},"58661bec99a6"(e,a,s){const t=function(e,a){if(e&&a)if("undefined"==typeof window||"function"!=typeof window.registerSfComponent){if("undefined"!=typeof window&&window.SF?.Loader?.registerComponent)window.SF.Loader.registerComponent(e,a);else if("undefined"!=typeof window){(window.SF_PENDING_COMPONENTS=window.SF_PENDING_COMPONENTS||[]).push([e,a])}}else window.registerSfComponent(e,a)};s.d(a,["A",0,t])},d7f974466839(e,a,s){s.d(a,{y:()=>t});class t{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 a=new Set;return e.forEach(e=>{if("string"!=typeof e)return;const s=e.match(/\(([^)]+)\)/g);s&&s.forEach(e=>{e.slice(1,-1).split(/\s+/).filter(Boolean).forEach(e=>{e.startsWith(".")&&e.length>1&&a.add(e.slice(1))})})}),Array.from(a)}applyLayoutUtilities(e,a){if(!e||!a)return;const s=this.getUtilityMap();if(!s||!s[a])return;this.extractUtilityClasses(s[a]).forEach(a=>e.classList.add(a))}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(){}}},"421676f72963"(e,a,s){s.d(a,{Ec:()=>l});const t="sfPopoverOpen",n=new WeakSet,o=Symbol.for("sf.openSurfaceLayers");function i(){const e=globalThis;return Array.isArray(e[o])||(e[o]=[]),e[o]}function l(e,a){if(!e)return;const s=Boolean(a);if(s===n.has(e))return;const o=i();if(s)n.add(e),o.push(e);else{n.delete(e);const a=o.lastIndexOf(e);a>=0&&o.splice(a,1)}!function(e){const a=globalThis.document?.documentElement;if(!a)return;const s=Math.max(0,Number(a.dataset[t]||0)+e);s?a.dataset[t]=String(s):delete a.dataset[t]}(s?1:-1)}},"2a25b3f4fc15"(e,a,s){s.a(e,async(e,a)=>{try{var t=s("c614c5e30b0d"),n=s("0d662e4d7d63"),o=s("c0450586011d"),i=s("fbe0570fcc69"),l=s("98e26702f55a"),r=s("788779012d8a"),m=e([n,o,i,r]);[n,o,i,r]=m.then?(await m)():m;var d=s.n(i);const f=".sf-country-code",u=Array.isArray(t?.items)?t.items:[];class c extends(d()){static get props(){return{size:{default:"1"},label:{default:""},ariaLabel:{attribute:"aria-label",default:""},required:{type:Boolean,default:!1},name:{default:""},form:{default:""},hint:{default:""},value:{default:""},placeholder:{default:"+7(___)___-__-__"},disabled:{type:Boolean,default:!1},open:{type:Boolean,default:!1},locale:{default:""},useMask:{type:Boolean,default:!1},useCountryMasks:{type:Boolean,default:!0},showCode:{type:Boolean,default:!0},maskStyle:{default:"native"},multiCountry:{type:Boolean,default:!0},iso2:{default:""},dialCode:{default:""},maskPattern:{default:""},flagBase:{default:""},lazyFlags:{type:Boolean,default:!0},showMaskPlaceholder:{type:Boolean,default:!1},maskPlaceholderChar:{default:"_"},maxItems:{type:Number,default:0}}}constructor(){super(),this._countries=null,this._boundRoot=null,this._renderAttributes=new Set}get size(){return(0,l.id)(this.getAttribute("size")||"1","sf-country-code")}get label(){return this.getAttribute("label")||""}get ariaLabel(){return this.getProp("ariaLabel")||""}get required(){return this.getBooleanAttr("required",!1)}get hint(){return this.getAttribute("hint")||""}get value(){return this.getAttribute("value")||""}get placeholder(){return this.getAttribute("placeholder")||"+7(___)___-__-__"}get disabled(){return this.getBooleanAttr("disabled",!1)}get open(){return this.getBooleanAttr("open",!1)||this.getBooleanAttr("active",!1)}get locale(){return"ru"===String(this.getAttribute("locale")||(0,n.pageLanguage)(this)).toLowerCase()?"ru":"en"}get useMask(){return this.getBooleanAttr("use-mask",!1)}get useCountryMasks(){return this.getBooleanAttr("use-country-masks",!0)}get showCode(){return this.getBooleanAttr("show-code",!0)}get maskStyle(){return"brackets"===String(this.getAttribute("mask-style")||"native").toLowerCase()?"brackets":"native"}get multiCountry(){return this.getBooleanAttr("multi-country",!0)}get iso2(){return(0,o.Xx)(this.getAttribute("iso2"))}get dialCode(){return String(this.getAttribute("dial-code")||"").trim()}get maskPattern(){return String(this.getAttribute("mask-pattern")||"").trim()}get flagBase(){return String(this.getAttribute("flag-base")||"").trim()||(0,o.Dk)()}get lazyFlags(){return this.getBooleanAttr("lazy-flags",!0)}get showMaskPlaceholder(){return this.getBooleanAttr("show-mask-placeholder",!1)}get maskPlaceholderChar(){return String(this.getAttribute("mask-placeholder-char")||"_")}get maxItems(){return Math.trunc(this.getNumberAttr("max-items",0))}get countries(){return(0,o.Ue)(this._countries,this.locale,this.maxItems)}set countries(e){this._countries=Array.isArray(e)?e:null,this.requestComponentUpdate("countries")}templateContext(){const e=this.getPropsContext(),a=this._boundRoot,s=a&&!this._renderAttributes.has("open")&&!this._renderAttributes.has("active"),t=a&&!this._renderAttributes.has("disabled");return this.createTemplateContext({...e,open:s?a.classList.contains("open"):this.open,disabled:t?!!a.querySelector("input")?.disabled||a.classList.contains("disabled"):this.disabled,countries:this.countries.length?this.countries:(0,o.Ue)(u,this.locale,this.maxItems),locale:this.locale,maskStyle:this.maskStyle,iso2:this.iso2,flagBase:this.flagBase,maxItems:this.maxItems})}onDisconnected(){this._boundRoot&&((0,o._i)(this._boundRoot),this._boundRoot=null)}beforeRender(e=[]){this._renderAttributes=new Set(e)}afterRender(e){if("function"==typeof e)return super.afterRender(e);this._boundRoot&&((0,o._i)(this._boundRoot),this._boundRoot=null),this._boundRoot=this.querySelector(f),this._boundRoot&&(0,o.nD)(this._boundRoot,{resetCountry:this._renderAttributes.has("iso2")||this._renderAttributes.has("dial-code"),countries:this.countries,maskPattern:this.maskPattern})}template(){return(0,r.o)(this.templateContext())}get state(){const e=this.querySelector(f),a=e?.querySelector?.(".sf-country-code-field input")||null;return{value:a?.value||"",iso2:e?.dataset?.iso2||"",dialCode:e?.dataset?.dialCode||"",open:e?.classList?.contains("open")||!1,disabled:e?.classList?.contains("disabled")||!1}}setState(e={}){const a=this.querySelector(f);return(0,o.nK)(a,e)}}c.define("sf-country-code"),a()}catch(e){a(e)}})},"788779012d8a"(e,a,s){s.a(e,async(e,t)=>{try{s.d(a,{o:()=>r});var n=s("ddf1cdb42ecc"),o=e([n]),i=o.then?(await o)():o;n=i[0];function l(e,a=""){const s=String(e?.iso2||"").trim().toLowerCase(),t=e?.flagEmoji||"",o=s&&a?`${a}/${s}.svg`:"";return o?n.html`
2
2
  <img
3
3
  alt=${e?.iso2?`${e.iso2} flag`:"flag"}
4
4
  decoding="async"
@@ -1,4 +1,4 @@
1
- (()=>{"use strict";var t={"98e26702f55a"(t,e,a){function s(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function n({component:t="",kind:e="attribute",attribute:a="",from:n,to:r=null}={}){if(!n)return;const i=[t,e,a,n].join("|"),o=s(),l=o.get(i);if(l)l.count+=1;else if(o.set(i,{component:t,kind:e,attribute:a,from:n,to:r,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const s=t?`${t}: `:"",i="value"===e?`${a}="${n}"`:`${e} ${n}`;globalThis.console?.warn?.(`[SIMAI Framework] ${s}${i} is a legacy name${r?`; write ${r}`:""}. See contracts/changes/journal.json.`)}}if(a.d(e,{id:()=>l}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...s().values()].map(t=>({...t}))},t.clear=function(){s().clear()},t.note=n,globalThis.SF.deprecations=t}const r=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),o=new Set;function l(t,e="field",a="1"){const s=String(t??"").trim().toLowerCase();if(r.includes(s))return s;if(Object.hasOwn(i,s)){const t=i[s];n({component:e,kind:"value",attribute:"size",from:s,to:t});const a=`${e}:${s}`;return o.has(a)||"undefined"==typeof console||(o.add(a),console.warn(`[SIMAI Framework] ${e}: size ${s} is retired for form fields; rendering size ${t}.`)),t}return a}},b9b65955223a(t,e,a){a.a(t,async(t,e)=>{try{var s=a("fbe0570fcc69"),n=a("98e26702f55a"),r=a("77b2f4107e3b"),i=a("5c1dc214bb5e"),o=a("0d662e4d7d63"),l=t([s,r,i,o]);[s,r,i,o]=l.then?(await l)():l;var h=a.n(s),u=a.n(i);const d=/^(\d{4})-(\d{2})-(\d{2})$/,c=18;let p=0;function g(t){return String(t).padStart(2,"0")}function m(t){return`${t.getFullYear()}-${g(t.getMonth()+1)}-${g(t.getDate())}`}function f(t,e="YYYY.MM.DD"){if(!t)return"";const a={YYYY:String(t.getFullYear()),YY:String(t.getFullYear()).slice(-2),MM:g(t.getMonth()+1),DD:g(t.getDate())};return String(e||"YYYY.MM.DD").replace(/YYYY|YY|MM|DD/g,t=>a[t]||t)}function b(t){return t instanceof Date&&!Number.isNaN(t.getTime())}function y(t){if(!t)return null;const e=String(t).match(d);if(!e)return null;const[,a,s,n]=e,r=new Date(Number(a),Number(s)-1,Number(n));return r.getFullYear()!==Number(a)||r.getMonth()!==Number(s)-1||r.getDate()!==Number(n)?null:r}function v(t,e="DD.MM.YYYY"){if(!t)return null;if(t instanceof Date)return b(t)?new Date(t.getFullYear(),t.getMonth(),t.getDate()):null;const a=String(t).trim(),s=y(a);if(s)return s;const n=a.match(/\d+/g),r=String(e||"DD.MM.YYYY").match(/YYYY|YY|MM|DD/g);if(!n||!r||n.length<3||r.length<3)return null;const i={};r.slice(0,3).forEach((t,e)=>{i[t]=Number(n[e])});let o=i.YYYY;!o&&i.YY&&(o=i.YY+2e3);const l=i.MM,h=i.DD;if(!o||!l||!h)return null;const u=new Date(o,l-1,h);return u.getFullYear()!==o||u.getMonth()!==l-1||u.getDate()!==h?null:u}function D(t,e=0){const a=(0,s.toNumber)(t,e);return Number.isFinite(a)?Math.max(0,Math.min(11,a)):e}function k(t,e){return t&&e&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function S(t,e){if(!t||!e)return 0;return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function w(t,e){const a=new Date(t.getFullYear(),t.getMonth()+e,1),s=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();return a.setDate(Math.min(t.getDate(),s)),a}function M(t,e,a){return!!(t&&e&&a)&&(S(t,e)>0&&S(t,a)<0)}function $(t="",e=null){const a=String(t||"").trim();return a||(0,o.pageLocale)(e??globalThis.document?.documentElement??null)}function x(t=""){const e=String(t||"");return e?`${e.charAt(0).toLocaleUpperCase()}${e.slice(1)}`:""}function P(t,e){try{return x(new Intl.DateTimeFormat(e,{month:"long"}).format(new Date(2026,t,1)))}catch{return String(t+1)}}function A(t,e){try{return new Intl.DateTimeFormat(e,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(t)}catch{return m(t)}}function Y(t,e=1){const a=new Date(2026,0,4);return Array.from({length:7},(s,n)=>{const r=new Date(a);r.setDate(a.getDate()+(e+n)%7);try{return new Intl.DateTimeFormat(t,{weekday:"short"}).format(r)}catch{return String((e+n)%7)}})}const V=["today","yesterday","last-7-days","last-30-days","this-week","this-month","last-month"];function _(t,e){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+e)}function F(t,e,a=1){const s=new Date(e.getFullYear(),e.getMonth(),e.getDate());switch(t){case"today":return[s,s];case"yesterday":return[_(s,-1),_(s,-1)];case"last-7-days":return[_(s,-6),s];case"last-30-days":return[_(s,-29),s];case"this-week":return[_(s,-(s.getDay()-a+7)%7),s];case"this-month":return[new Date(s.getFullYear(),s.getMonth(),1),s];case"last-month":return[new Date(s.getFullYear(),s.getMonth()-1,1),new Date(s.getFullYear(),s.getMonth(),0)];default:return null}}const C={en:{previousMonth:"Previous month",nextMonth:"Next month",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",presets:"Quick ranges",customRange:"Custom range",preset_today:"Today",preset_yesterday:"Yesterday",preset_last7Days:"Last 7 days",preset_last30Days:"Last 30 days",preset_thisWeek:"This week",preset_thisMonth:"This month",preset_lastMonth:"Last month"},ru:{previousMonth:"Предыдущий месяц",nextMonth:"Следующий месяц",previousYears:"Предыдущие годы",nextYears:"Следующие годы",chooseMonth:"Выберите месяц",chooseYear:"Выберите год",presets:"Быстрый выбор",customRange:"Свой период",preset_today:"Сегодня",preset_yesterday:"Вчера",preset_last7Days:"Последние 7 дней",preset_last30Days:"Последние 30 дней",preset_thisWeek:"Эта неделя",preset_thisMonth:"Этот месяц",preset_lastMonth:"Прошлый месяц"}};class T extends(h()){constructor(){super(),this._input=null,this._documentClickHandler=this.handleDocumentClick.bind(this),this._documentKeydownHandler=this.handleDocumentKeydown.bind(this),this._viewportHandler=this.positionPanel.bind(this),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1,this._panelId="sf-datepicker-panel-"+ ++p,this.state={openAbove:!1,yearPageStart:null,activeDate:""},this.refs={input:this.createRef(),datePickerRoot:this.createRef(),datePickerPanel:this.createRef()}}static get props(){return{templateName:{attribute:"template",default:"default"},value:{default:""},date:{default:""},startValue:{attribute:"start-value",default:""},endValue:{attribute:"end-value",default:""},maxDate:{default:""},minDate:{default:""},range:{type:Boolean,default:!1},month:{type:Number,default:null},year:{type:Number,default:null},context:{default:""},weekStart:{type:Number,default:null},locale:{default:""},format:{default:"DD.MM.YYYY"},rootClass:{default:""},closeOnSelect:{type:Boolean,default:!0},input:{type:Boolean,default:!0},open:{type:Boolean,default:!1},portal:{type:Boolean,default:!0},inputType:{attribute:"input-type",default:"bordered"},size:{default:"1"},inputSize:{attribute:"input-size",default:"1"},inputName:{attribute:"input-name",default:""},name:{attribute:"name",default:""},placeholder:{default:""},label:{default:""},ariaLabel:{attribute:"aria-label",default:""},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},iconStart:{type:String,attribute:"icon-start",default:null},leftIcon:{attribute:"left-icon",default:"calendar_today"},inputRootClass:{attribute:"input-root-class",default:""},mask:{type:Boolean,default:!1},maskPattern:{attribute:"mask-pattern",default:""},maskLazy:{attribute:"mask-lazy",default:!1},maskPlaceholderChar:{attribute:"mask-placeholder-char",default:"_"},maskOptions:{attribute:"mask-options",default:""},presets:{default:""},preset:{default:""}}}connectedCallback(){this.upgradeProperty("value"),this.upgradeProperty("presets"),super.connectedCallback()}upgradeProperty(t){if(!Object.prototype.hasOwnProperty.call(this,t))return;const e=this[t];delete this[t],this[t]=e}get componentName(){return"datepicker"}get templateName(){return this.getAttribute("template")||"default"}get selectedDate(){return v(this.date,this.format)}get primaryDate(){const t=this.activePreset;return t?t.to:this.selectedDate||this.startDate}get presets(){return this._presetList??(this.getAttribute("presets")||"")}set presets(t){if(Array.isArray(t))return this._presetList=t,void this.requestComponentUpdate("presets");this._presetList=null,this.setState({presets:t?String(t):""})}get preset(){return this.getAttribute("preset")||""}set preset(t){this.setState({preset:t?String(t):""})}get presetItems(){if(!this.range)return[];const t=Array.isArray(this.presets)?this.presets:String(this.presets).split(/[\s,]+/).filter(Boolean),e=new Date,a=this.setMinDate(),s=this.setMaxDate();return t.map(t=>{const n="string"==typeof t?{id:t,relative:t}:{...t};if(!n?.id)return null;let r=null;if(n.relative)r=F(n.relative,e,this.weekStart);else if(Array.isArray(n.range)){const t=v(n.range[0],this.format),e=v(n.range[1],this.format);t&&e&&(r=S(t,e)<=0?[t,e]:[e,t])}if(!r)return null;let[i,l]=r;a&&S(i,a)<0&&(i=a),s&&S(l,s)>0&&(l=s);const h=S(i,l)>0,u=n.label||(V.includes(n.id)?(0,o.pageText)(C,(d=n.id,`preset_${String(d).replace(/-([a-z0-9])/g,(t,e)=>e.toUpperCase())}`),this,"sf-datepicker"):n.id);var d;return{id:String(n.id),label:u,relative:n.relative||null,from:i,to:l,disabled:h,pressed:this.preset===String(n.id)}}).filter(Boolean)}get activePreset(){const t=this.preset;if(!t||!this.range)return null;const e=this.presetItems.find(e=>e.id===t);return e&&!e.disabled?e:null}get startDate(){return v(this.startValue,this.format)}get endDate(){return v(this.endValue,this.format)}get date(){return this.getAttribute("date")||this.getAttribute("value")||""}get value(){return this.range?[this.startValue,this.endValue]:this.date}set value(t){if(Array.isArray(t)){const[e="",a=""]=t;return void this.setState({date:e||"",startValue:e||"",endValue:a||""})}if(t&&"object"==typeof t){const e=t.start||t.startValue||t.date||"",a=t.end||t.endValue||"";return void this.setState({date:t.date||e||"",startValue:e,endValue:a})}this.setState({date:t?String(t):"",startValue:"",endValue:""})}setMaxDate(){return v(this.maxDate,this.format)}setMinDate(){return v(this.minDate,this.format)}get maxDate(){return this.getAttribute("max-date")||""}get minDate(){return this.getAttribute("min-date")||""}set date(t){this.setState({date:t?String(t):""})}get startValue(){const t=this.activePreset;return t?m(t.from):this.getAttribute("start-value")||""}set startValue(t){this.setState({startValue:t?String(t):""})}get endValue(){const t=this.activePreset;return t?m(t.to):this.getAttribute("end-value")||""}set endValue(t){this.setState({endValue:t?String(t):""})}get range(){return this.getBooleanAttr("range",!1)}get input(){return this.getBooleanAttr("input",!0)}get open(){return this.getBooleanAttr("open",!1)}get portal(){return this.getBooleanAttr("portal",!0)}get inputType(){return this.getAttribute("input-type")||"bordered"}get size(){return(0,n.id)(this.getAttribute("size")||this.getAttribute("input-size")||"1","sf-datepicker")}get inputSize(){return this.size}get inputName(){return this.getAttribute("input-name")||this.getAttribute("name")||""}get placeholder(){return this.getAttribute("placeholder")||""}get label(){return this.getAttribute("label")||""}get disabled(){return this.getBooleanAttr("disabled",!1)}get required(){return this.getBooleanAttr("required",!1)}get closeOnSelect(){return this.getBooleanAttr("close-on-select",!0)}get leftIcon(){return this.hasAttribute("icon-start")?this.getAttribute("icon-start"):this.getAttribute("left-icon")||"calendar_today"}get iconStart(){return this.leftIcon}get inputRootClass(){return this.getAttribute("input-root-class")||""}get mask(){return this.getBooleanAttr("mask",!1)}get maskPattern(){return this.getAttribute("mask-pattern")||this.formatToMask(this.format)}get maskLazy(){return!!this.hasAttribute("mask-lazy")&&this.getBooleanAttr("mask-lazy",!1)}get maskPlaceholderChar(){return this.getAttribute("mask-placeholder-char")||"_"}get maskOptions(){return this.getAttribute("mask-options")||""}get year(){const t=this.primaryDate,e=t?t.getFullYear():(new Date).getFullYear();return this.hasAttribute("year")?this.getNumberAttr("year",e):e}set year(t){this.setState({year:null==t||""===t?"":String((0,s.toNumber)(t,(new Date).getFullYear()))})}get month(){const t=this.primaryDate,e=t?t.getMonth():(new Date).getMonth();return this.hasAttribute("month")?D(this.getAttribute("month"),e):e}set month(t){this.setState({month:null==t||""===t?"":String(D(t,(new Date).getMonth()))})}get contextMode(){return this.getEnumAttr("context",["month","year",""],"")}get weekStart(){if(this.hasAttribute("week-start")){const t=this.getNumberAttr("week-start",1);return Number.isInteger(t)&&t>=0&&t<=7?t%7:1}try{const t=new Intl.Locale(this.locale),e="function"==typeof t.getWeekInfo?t.getWeekInfo():t.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 1}get locale(){return $(this.getAttribute("locale"),this)}get format(){return this.getAttribute("format")||"DD.MM.YYYY"}get ariaLabel(){return this.getProp("ariaLabel")||""}get readonly(){return this.range||this.getBooleanAttr("readonly",!1)}get typed(){return!this.readonly&&!this.disabled}get formattedValue(){return f(this.selectedDate,this.format)}get formattedStartValue(){return f(this.startDate,this.format)}get formattedEndValue(){return f(this.endDate,this.format)}get displayValue(){return this.range?this.formattedStartValue&&this.formattedEndValue?`${this.formattedStartValue} - ${this.formattedEndValue}`:this.formattedStartValue||this.formattedEndValue||"":this.formattedValue}get displayDate(){return new Date(this.year,this.month,1)}get isRtl(){return"rtl"===(this.closest("[dir]")?.getAttribute("dir")||document.documentElement?.dir)}get labels(){return t=this,Object.fromEntries(["previousMonth","nextMonth","previousYears","nextYears","chooseMonth","chooseYear","presets","customRange"].map(e=>[e,(0,o.pageText)(C,e,t,"sf-datepicker")]));var t}get weekdays(){return Y(this.locale,this.weekStart)}get calendarLabel(){try{return new Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.displayDate)}catch{return`${this.month+1}.${this.year}`}}get activeDate(){const t=y(this.state.activeDate)||this.primaryDate||this.displayDate,e=this.setMinDate(),a=this.setMaxDate();return e&&S(t,e)<0?e:a&&S(t,a)>0?a:t}get normalizedRange(){const t=this.startDate,e=this.endDate;return t&&e?S(t,e)<=0?{startDate:t,endDate:e}:{startDate:e,endDate:t}:{startDate:t,endDate:e}}get days(){const t=(new Date(this.year,this.month,1).getDay()-this.weekStart+7)%7,e=new Date(this.year,this.month,1-t),{startDate:a,endDate:s}=this.normalizedRange,n=Boolean(this.startValue&&this.endValue),r=this.setMinDate(),i=this.setMaxDate(),o=this.activeDate,l=new Date;return Array.from({length:42}).map((t,h)=>{const u=new Date(e.getFullYear(),e.getMonth(),e.getDate()+h),d=u.getTime(),c=Boolean(r&&d<r.getTime()||i&&d>i.getTime());return{date:u,value:m(u),formattedValue:f(u,this.format),label:A(u,this.locale),day:u.getDate(),today:k(u,l),currentMonth:u.getMonth()===this.month,weekend:[0,6].includes(u.getDay()),disabled:c,selected:this.range?k(u,a)||k(u,s):k(u,this.selectedDate),rangeStart:this.range&&n&&k(u,a),rangeEnd:this.range&&n&&k(u,s),rangeSelected:this.range&&n&&M(u,a,s),tabIndex:!c&&k(u,o)?0:-1}})}get months(){const t=this.setMinDate(),e=this.setMaxDate(),a=t?new Date(t.getFullYear(),t.getMonth(),1):null,s=e?new Date(e.getFullYear(),e.getMonth(),1):null;return Array.from({length:12}).map((t,e)=>{const n=new Date(this.year,e,1).getTime(),r=Boolean(a&&n<a.getTime()||s&&n>s.getTime());return{index:e,label:P(e,this.locale),selected:e===this.month,disabled:r}})}get years(){const t=this.setMinDate(),e=this.setMaxDate(),a=this.yearPageStart;return Array.from({length:c}).map((s,n)=>{const r=a+n;return{year:r,disabled:Boolean(t&&r<t.getFullYear()||e&&r>e.getFullYear()),selected:r===this.year}})}get yearPageStart(){return this.state.yearPageStart??this.getYearPageStart(this.year)}get yearPageEnd(){return this.yearPageStart+c-1}getYearPageStart(t=this.year){const e=(0,s.toNumber)(t,(new Date).getFullYear());return e-e%c}formatToMask=t=>{let e=String(t).replace(/[A-Za-z]/g,"0");return this.range&&(e+=` - ${e}`),e};setContext(t=""){return this.setState({context:t||""}),this}toggleContext(t){const e=this.contextMode===t?"":t,a={context:e};return"year"===e&&(a.yearPageStart=this.getYearPageStart(this.year)),this.setState(a),this}shiftYearPage(t=1){return this.set({yearPageStart:this.yearPageStart+c*t}),this}shiftMonth(t=1){const e=new Date(this.year,this.month+t,1),a=this.setMinDate(),s=this.setMaxDate();return a&&e<new Date(a.getFullYear(),a.getMonth(),1)||s&&e>new Date(s.getFullYear(),s.getMonth(),1)||(this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:m(e)})),this}setActiveDate(t){const e=y(t);return e&&this.state.activeDate!==t?(this.set({activeDate:m(e)}),this):this}moveActiveDate(t){const e=new Date(this.activeDate);e.setDate(e.getDate()+t);const a=this.setMinDate(),s=this.setMaxDate();return a&&S(e,a)<0||s&&S(e,s)>0||(this._focusDateAfterRender=!0,this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:m(e)})),this}openPanel({focusCalendar:t=!1}={}){return this.disabled?this:(this._focusCalendarOnOpen=t,this.state.activeDate||this.set({activeDate:m(this.activeDate)}),this.open?(this.positionPanel(),this):(this.setState({open:!0}),this))}closePanel({restoreFocus:t=!1}={}){return this.open?(this.setState({open:!1,context:""}),t&&requestAnimationFrame(()=>this._input?.focus?.()),this):this}togglePanel(){return this.open?this.closePanel():this.openPanel()}handleInputChange(t){if(!this.typed)return;"change"===t?.type&&t.stopPropagation();const e=t?.target,a=String(e?.value??"").trim(),s=()=>{const t=e?.querySelector?.("input")||e;t&&"value"in t&&(t.value=this.displayValue)};if(!a){if(!this.date)return;return this.setState({date:"",context:""}),void this.emitChange()}const n=v(a,this.format),r=this.setMinDate(),i=this.setMaxDate(),o=Boolean(n)&&(r&&S(n,r)<0||i&&S(n,i)>0);if(!n||o)return void s();const l=m(n);l!==this.date?(this.setState({year:n.getFullYear(),month:n.getMonth(),date:l,context:""}),this.set({activeDate:l}),this.emitChange()):s()}handleInputInput(t){this.typed&&t?.stopPropagation?.()}handleInputClick(t){t?.preventDefault?.(),t?.stopPropagation?.(),this.openPanel()}handleInputKeydown(t){if(this.typed){if("ArrowDown"!==t.key&&"Enter"!==t.key)return;return t.preventDefault(),"Enter"===t.key?void this.handleInputChange(t):void this.openPanel({focusCalendar:!0})}["ArrowDown","Enter"," "].includes(t.key)&&(t.preventDefault(),this.openPanel({focusCalendar:!0}))}handleDayKeydown(t,e){const a=this.isRtl?-1:1,s={ArrowLeft:-a,ArrowRight:a,ArrowUp:-7,ArrowDown:7};if(Object.prototype.hasOwnProperty.call(s,t.key))return t.preventDefault(),void this.moveActiveDate(s[t.key]);if("Home"===t.key||"End"===t.key){t.preventDefault();const a=((e?.date||this.activeDate).getDay()-this.weekStart+7)%7;return void this.moveActiveDate("Home"===t.key?-a:6-a)}if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault();const e="PageUp"===t.key?-1:1;let a=w(this.activeDate,e);const s=this.setMinDate(),n=this.setMaxDate();s&&S(a,s)<0&&(a=s),n&&S(a,n)>0&&(a=n),this._focusDateAfterRender=!0,this.setState({year:a.getFullYear(),month:a.getMonth()}),this.set({activeDate:m(a)})}}handlePanelClick(t){t?.stopPropagation?.()}handleDocumentClick(t){if(!this.open)return;const e=t.target;this.contains(e)||this.refs.datePickerPanel.value?.contains?.(e)||this.closePanel()}handleDocumentKeydown(t){this.open&&"Escape"===t.key&&(t.preventDefault(),this.contextMode?this.setContext(""):(this.closePanel(),requestAnimationFrame(()=>this._input?.focus?.())))}syncOverlayListeners(){if(this.input&&this.open)return document.addEventListener("click",this._documentClickHandler),void document.addEventListener("keydown",this._documentKeydownHandler);this.removeOverlayListeners()}removeOverlayListeners(){document.removeEventListener("click",this._documentClickHandler),document.removeEventListener("keydown",this._documentKeydownHandler),this.stopPanelPosition(),window.removeEventListener("resize",this._viewportHandler),document.removeEventListener("scroll",this._viewportHandler,!0),window.visualViewport?.removeEventListener("resize",this._viewportHandler),window.visualViewport?.removeEventListener("scroll",this._viewportHandler)}positionPanel(){const t=this.refs.datePickerPanel.value,e=this._input?.closest(".sf-input-field")||this._input||this.querySelector("sf-input");if(this.isConnected&&this.input&&this.portal&&this.open&&t?.isConnected&&e)return this._panelAnchor&&this._panelAnchorPanel===t&&this._panelAnchorTrigger===e?void this._panelAnchor.update():(this.stopPanelPosition(),Object.assign(t.style,{overflowY:"auto",zIndex:"var(--sf-z-index-9)"}),this._panelAnchorPanel=t,this._panelAnchorTrigger=e,void(this._panelAnchor=(globalThis.SF?.Position||u()).anchor(e,t,{side:"block-end",align:"start",onPosition:({side:t})=>{const e="block-start"===t;Boolean(this.state.openAbove)!==e&&this.set({openAbove:e})}})));this.stopPanelPosition()}stopPanelPosition(){this._panelAnchor?.stop(),this._panelAnchor=null,this._panelAnchorPanel=null,this._panelAnchorTrigger=null}selectDate(t){return!t?.date||t.disabled?this:this.range?(this.selectRangeDate(t),this):(this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),date:t.value,context:""}),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this)}selectRangeDate(t){if(!this.startValue||this.startValue&&this.endValue)return this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),startValue:t.value,endValue:"",date:t.value,context:"",preset:""}),this.set({activeDate:t.value}),this.emitChange(),this;const e=this.startDate,a={year:t.date.getFullYear(),month:t.date.getMonth(),context:"",preset:""};return e&&S(t.date,e)<0?(a.startValue=t.value,a.endValue=this.startValue,a.date=t.value):(a.endValue=t.value,a.date=this.startValue),this.setState(a),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}choosePreset(t){if(!t||t.disabled)return this;const e=m(t.from),a=m(t.to);return this.setState({preset:t.id,startValue:e,endValue:a,date:e,year:t.to.getFullYear(),month:t.to.getMonth(),context:""}),this.set({activeDate:a}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}chooseCustomRange(){return this.preset&&this.setState({preset:"",startValue:"",endValue:"",date:""}),this._focusDateAfterRender=!0,this.requestComponentUpdate("custom-range"),this}handlePresetKeydown(t){const e={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};if(!(t.key in e)&&"Home"!==t.key&&"End"!==t.key)return;const a=[...t.currentTarget.querySelectorAll("button:not(:disabled)")];if(!a.length)return;t.preventDefault();const s=a.indexOf(t.target);let n="Home"===t.key?0:"End"===t.key?a.length-1:s+e[t.key];!this.isRtl||"ArrowRight"!==t.key&&"ArrowLeft"!==t.key||(n=s-e[t.key]),n=(n+a.length)%a.length,a.forEach((t,e)=>t.setAttribute("tabindex",e===n?"0":"-1")),a[n].focus()}selectMonth(t){return!t||t.disabled||(this.setState({month:t.index,context:""}),this.set({activeDate:m(new Date(this.year,t.index,1))})),this}selectYear(t){if(!t||t.disabled)return this;const e={year:t.year,context:""},a=this.getClosestEnabledMonth(t.year,this.month);return a!==this.month&&(e.month=a),this.setState(e),this.set({activeDate:m(new Date(t.year,a,1))}),this}getClosestEnabledMonth(t,e){const a=this.setMinDate(),s=this.setMaxDate();return a&&t===a.getFullYear()&&e<a.getMonth()?a.getMonth():s&&t===s.getFullYear()&&e>s.getMonth()?s.getMonth():e}emitChange(){const t=this.startValue&&this.endValue?`${this.startValue}/${this.endValue}`:this.startValue||"",e=this.range?{value:[this.startValue,this.endValue],date:t,startValue:this.startValue,endValue:this.endValue,formattedValue:this.displayValue,formattedStartValue:this.formattedStartValue,formattedEndValue:this.formattedEndValue,isoValue:t,startIsoValue:this.startValue,endIsoValue:this.endValue,range:!0,format:this.format,preset:this.activePreset?this.activePreset.relative?{id:this.activePreset.id,relative:this.activePreset.relative}:{id:this.activePreset.id}:null}:{value:this.date,date:this.date,formattedValue:this.formattedValue,isoValue:this.date,range:!1,format:this.format};this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e})),this.dispatchEvent(new CustomEvent("sf-datepicker-change",{bubbles:!0,composed:!0,detail:e})),this.emitComponentEvent("change",e)}templateContext(){const t=this.getPropsContext();return this.createTemplateContext({...t,component:this,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,selectedDate:this.selectedDate,startDate:this.startDate,endDate:this.endDate,year:this.year,month:this.month,monthLabel:P(this.month,this.locale),calendarLabel:this.calendarLabel,labels:this.labels,weekdays:this.weekdays,panelId:this._panelId,previousIcon:this.isRtl?"chevron_right":"chevron_left",nextIcon:this.isRtl?"chevron_left":"chevron_right",context:this.contextMode,locale:this.locale,days:this.days,presetItems:this.presetItems,months:this.months,years:this.years,yearPageStart:this.yearPageStart,yearPageEnd:this.yearPageEnd,rootClass:this.getRootClass(),rootStyle:this.getRootStyle(),openAbove:Boolean(this.state.openAbove),input:this.input,open:this.open,portal:this.portal,inputType:this.inputType,inputSize:this.inputSize,inputName:this.inputName,placeholder:this.placeholder,label:this.label,ariaLabel:this.ariaLabel,readonly:this.readonly,disabled:this.disabled,required:this.required,leftIcon:this.leftIcon,iconStart:this.leftIcon,inputRootClass:this.inputRootClass,mask:this.mask,maskPattern:this.maskPattern,maskLazy:this.maskLazy,maskPlaceholderChar:this.maskPlaceholderChar,maskOptions:this.maskOptions})}template(){return(0,r.P)(this.templateContext())}afterRender(){this._input=this.refs.input?.value?.querySelector("input")||null,this._input&&(this._input.setAttribute("aria-haspopup","dialog"),this._input.setAttribute("aria-expanded",this.open?"true":"false"),this._input.setAttribute("aria-controls",this._panelId));const t=this.querySelector(".sf-datepicker-month-toggle button"),e=this.querySelector(".sf-datepicker-year-toggle button");t?.setAttribute("aria-expanded","month"===this.contextMode?"true":"false"),e?.setAttribute("aria-expanded","year"===this.contextMode?"true":"false"),this.syncOverlayListeners(),requestAnimationFrame(()=>{if(this.positionPanel(),this._focusCalendarOnOpen||this._focusDateAfterRender){const t=this.querySelector(`.sf-datepicker-day[data-date="${m(this.activeDate)}"]`);t?.focus?.(),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1}})}onDisconnected(){this.removeOverlayListeners(),super.onDisconnected()}get data(){return{value:this.value,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,year:this.year,month:this.month,context:this.contextMode,maxDate:this.maxDate,minDate:this.minDate,locale:this.locale,input:this.input,open:this.open,portal:this.portal,mask:this.mask,maskPattern:this.maskPattern,maskOptions:this.maskOptions,presets:this.presetItems.map(({id:t,label:e,relative:a,disabled:s})=>({id:t,label:e,relative:a,disabled:s})),preset:this.preset}}}T.define("sf-datepicker"),e()}catch(E){e(E)}})},"77b2f4107e3b"(t,e,a){a.a(t,async(t,s)=>{try{a.d(e,{P:()=>b});var n=a("ddf1cdb42ecc"),r=a("5a8eddcd589d"),i=t([n,r]);[n,r]=i.then?(await i)():i;function o(...t){return t.flat().filter(Boolean).join(" ")}function l(t){return n.html`
1
+ (()=>{"use strict";var t={"98e26702f55a"(t,e,a){function s(){const t=globalThis.SF=globalThis.SF||{};return t.__deprecationNotes instanceof Map||Object.defineProperty(t,"__deprecationNotes",{value:new Map,configurable:!0}),t.__deprecationNotes}function n({component:t="",kind:e="attribute",attribute:a="",from:n,to:r=null}={}){if(!n)return;const i=[t,e,a,n].join("|"),o=s(),l=o.get(i);if(l)l.count+=1;else if(o.set(i,{component:t,kind:e,attribute:a,from:n,to:r,count:1}),function(){const t=globalThis.document?.documentElement;return"warn"===t?.dataset?.sfDeprecations||!0===globalThis.SF?.deprecations?.warn}()){const s=t?`${t}: `:"",i="value"===e?`${a}="${n}"`:`${e} ${n}`;globalThis.console?.warn?.(`[SIMAI Framework] ${s}${i} is a legacy name${r?`; write ${r}`:""}. See contracts/changes/journal.json.`)}}if(a.d(e,{id:()=>l}),"undefined"!=typeof globalThis){globalThis.SF=globalThis.SF||{};const t=globalThis.SF.deprecations||{};t.list=function(){return[...s().values()].map(t=>({...t}))},t.clear=function(){s().clear()},t.note=n,globalThis.SF.deprecations=t}const r=Object.freeze(["1/2","1","2"]),i=Object.freeze({"1/3":"1/2",3:"2"}),o=new Set;function l(t,e="field",a="1"){const s=String(t??"").trim().toLowerCase();if(r.includes(s))return s;if(Object.hasOwn(i,s)){const t=i[s];n({component:e,kind:"value",attribute:"size",from:s,to:t});const a=`${e}:${s}`;return o.has(a)||"undefined"==typeof console||(o.add(a),console.warn(`[SIMAI Framework] ${e}: size ${s} is retired for form fields; rendering size ${t}.`)),t}return a}},"421676f72963"(t,e,a){a.d(e,{Ec:()=>o,Hw:()=>l});const s="sfPopoverOpen",n=new WeakSet,r=Symbol.for("sf.openSurfaceLayers");function i(){const t=globalThis;return Array.isArray(t[r])||(t[r]=[]),t[r]}function o(t,e){if(!t)return;const a=Boolean(e);if(a===n.has(t))return;const r=i();if(a)n.add(t),r.push(t);else{n.delete(t);const e=r.lastIndexOf(t);e>=0&&r.splice(e,1)}!function(t){const e=globalThis.document?.documentElement;if(!e)return;const a=Math.max(0,Number(e.dataset[s]||0)+t);a?e.dataset[s]=String(a):delete e.dataset[s]}(a?1:-1)}function l(t){const e=i();for(let a=e.length-1;a>=0;a-=1){const s=e[a];if(!1!==s?.isConnected)return s===t}return!0}},b9b65955223a(t,e,a){a.a(t,async(t,e)=>{try{var s=a("fbe0570fcc69"),n=a("98e26702f55a"),r=a("77b2f4107e3b"),i=a("5c1dc214bb5e"),o=a("0d662e4d7d63"),l=a("421676f72963"),u=t([s,r,i,o]);[s,r,i,o]=u.then?(await u)():u;var h=a.n(s),c=a.n(i);const d=/^(\d{4})-(\d{2})-(\d{2})$/,p=18;let g=0;function m(t){return String(t).padStart(2,"0")}function f(t){return`${t.getFullYear()}-${m(t.getMonth()+1)}-${m(t.getDate())}`}function b(t,e="YYYY.MM.DD"){if(!t)return"";const a={YYYY:String(t.getFullYear()),YY:String(t.getFullYear()).slice(-2),MM:m(t.getMonth()+1),DD:m(t.getDate())};return String(e||"YYYY.MM.DD").replace(/YYYY|YY|MM|DD/g,t=>a[t]||t)}function y(t){return t instanceof Date&&!Number.isNaN(t.getTime())}function v(t){if(!t)return null;const e=String(t).match(d);if(!e)return null;const[,a,s,n]=e,r=new Date(Number(a),Number(s)-1,Number(n));return r.getFullYear()!==Number(a)||r.getMonth()!==Number(s)-1||r.getDate()!==Number(n)?null:r}function D(t,e="DD.MM.YYYY"){if(!t)return null;if(t instanceof Date)return y(t)?new Date(t.getFullYear(),t.getMonth(),t.getDate()):null;const a=String(t).trim(),s=v(a);if(s)return s;const n=a.match(/\d+/g),r=String(e||"DD.MM.YYYY").match(/YYYY|YY|MM|DD/g);if(!n||!r||n.length<3||r.length<3)return null;const i={};r.slice(0,3).forEach((t,e)=>{i[t]=Number(n[e])});let o=i.YYYY;!o&&i.YY&&(o=i.YY+2e3);const l=i.MM,u=i.DD;if(!o||!l||!u)return null;const h=new Date(o,l-1,u);return h.getFullYear()!==o||h.getMonth()!==l-1||h.getDate()!==u?null:h}function k(t,e=0){const a=(0,s.toNumber)(t,e);return Number.isFinite(a)?Math.max(0,Math.min(11,a)):e}function S(t,e){return t&&e&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function w(t,e){if(!t||!e)return 0;return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function M(t,e){const a=new Date(t.getFullYear(),t.getMonth()+e,1),s=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();return a.setDate(Math.min(t.getDate(),s)),a}function $(t,e,a){return!!(t&&e&&a)&&(w(t,e)>0&&w(t,a)<0)}function x(t="",e=null){const a=String(t||"").trim();return a||(0,o.pageLocale)(e??globalThis.document?.documentElement??null)}function P(t=""){const e=String(t||"");return e?`${e.charAt(0).toLocaleUpperCase()}${e.slice(1)}`:""}function A(t,e){try{return P(new Intl.DateTimeFormat(e,{month:"long"}).format(new Date(2026,t,1)))}catch{return String(t+1)}}function Y(t,e){try{return new Intl.DateTimeFormat(e,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(t)}catch{return f(t)}}function V(t,e=1){const a=new Date(2026,0,4);return Array.from({length:7},(s,n)=>{const r=new Date(a);r.setDate(a.getDate()+(e+n)%7);try{return new Intl.DateTimeFormat(t,{weekday:"short"}).format(r)}catch{return String((e+n)%7)}})}const _=["today","yesterday","last-7-days","last-30-days","this-week","this-month","last-month"];function F(t,e){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+e)}function C(t,e,a=1){const s=new Date(e.getFullYear(),e.getMonth(),e.getDate());switch(t){case"today":return[s,s];case"yesterday":return[F(s,-1),F(s,-1)];case"last-7-days":return[F(s,-6),s];case"last-30-days":return[F(s,-29),s];case"this-week":return[F(s,-(s.getDay()-a+7)%7),s];case"this-month":return[new Date(s.getFullYear(),s.getMonth(),1),s];case"last-month":return[new Date(s.getFullYear(),s.getMonth()-1,1),new Date(s.getFullYear(),s.getMonth(),0)];default:return null}}const T={en:{previousMonth:"Previous month",nextMonth:"Next month",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",presets:"Quick ranges",customRange:"Custom range",preset_today:"Today",preset_yesterday:"Yesterday",preset_last7Days:"Last 7 days",preset_last30Days:"Last 30 days",preset_thisWeek:"This week",preset_thisMonth:"This month",preset_lastMonth:"Last month"},ru:{previousMonth:"Предыдущий месяц",nextMonth:"Следующий месяц",previousYears:"Предыдущие годы",nextYears:"Следующие годы",chooseMonth:"Выберите месяц",chooseYear:"Выберите год",presets:"Быстрый выбор",customRange:"Свой период",preset_today:"Сегодня",preset_yesterday:"Вчера",preset_last7Days:"Последние 7 дней",preset_last30Days:"Последние 30 дней",preset_thisWeek:"Эта неделя",preset_thisMonth:"Этот месяц",preset_lastMonth:"Прошлый месяц"}};class E extends(h()){constructor(){super(),this._input=null,this._documentClickHandler=this.handleDocumentClick.bind(this),this._documentKeydownHandler=this.handleDocumentKeydown.bind(this),this._viewportHandler=this.positionPanel.bind(this),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1,this._panelId="sf-datepicker-panel-"+ ++g,this.state={openAbove:!1,yearPageStart:null,activeDate:""},this.refs={input:this.createRef(),datePickerRoot:this.createRef(),datePickerPanel:this.createRef()}}static get props(){return{templateName:{attribute:"template",default:"default"},value:{default:""},date:{default:""},startValue:{attribute:"start-value",default:""},endValue:{attribute:"end-value",default:""},maxDate:{default:""},minDate:{default:""},range:{type:Boolean,default:!1},month:{type:Number,default:null},year:{type:Number,default:null},context:{default:""},weekStart:{type:Number,default:null},locale:{default:""},format:{default:"DD.MM.YYYY"},rootClass:{default:""},closeOnSelect:{type:Boolean,default:!0},input:{type:Boolean,default:!0},open:{type:Boolean,default:!1},portal:{type:Boolean,default:!0},inputType:{attribute:"input-type",default:"bordered"},size:{default:"1"},inputSize:{attribute:"input-size",default:"1"},inputName:{attribute:"input-name",default:""},name:{attribute:"name",default:""},placeholder:{default:""},label:{default:""},ariaLabel:{attribute:"aria-label",default:""},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},iconStart:{type:String,attribute:"icon-start",default:null},leftIcon:{attribute:"left-icon",default:"calendar_today"},inputRootClass:{attribute:"input-root-class",default:""},mask:{type:Boolean,default:!1},maskPattern:{attribute:"mask-pattern",default:""},maskLazy:{attribute:"mask-lazy",default:!1},maskPlaceholderChar:{attribute:"mask-placeholder-char",default:"_"},maskOptions:{attribute:"mask-options",default:""},presets:{default:""},preset:{default:""}}}connectedCallback(){this.upgradeProperty("value"),this.upgradeProperty("presets"),super.connectedCallback()}upgradeProperty(t){if(!Object.prototype.hasOwnProperty.call(this,t))return;const e=this[t];delete this[t],this[t]=e}get componentName(){return"datepicker"}get templateName(){return this.getAttribute("template")||"default"}get selectedDate(){return D(this.date,this.format)}get primaryDate(){const t=this.activePreset;return t?t.to:this.selectedDate||this.startDate}get presets(){return this._presetList??(this.getAttribute("presets")||"")}set presets(t){if(Array.isArray(t))return this._presetList=t,void this.requestComponentUpdate("presets");this._presetList=null,this.setState({presets:t?String(t):""})}get preset(){return this.getAttribute("preset")||""}set preset(t){this.setState({preset:t?String(t):""})}get presetItems(){if(!this.range)return[];const t=Array.isArray(this.presets)?this.presets:String(this.presets).split(/[\s,]+/).filter(Boolean),e=new Date,a=this.setMinDate(),s=this.setMaxDate();return t.map(t=>{const n="string"==typeof t?{id:t,relative:t}:{...t};if(!n?.id)return null;let r=null;if(n.relative)r=C(n.relative,e,this.weekStart);else if(Array.isArray(n.range)){const t=D(n.range[0],this.format),e=D(n.range[1],this.format);t&&e&&(r=w(t,e)<=0?[t,e]:[e,t])}if(!r)return null;let[i,l]=r;a&&w(i,a)<0&&(i=a),s&&w(l,s)>0&&(l=s);const u=w(i,l)>0,h=n.label||(_.includes(n.id)?(0,o.pageText)(T,(c=n.id,`preset_${String(c).replace(/-([a-z0-9])/g,(t,e)=>e.toUpperCase())}`),this,"sf-datepicker"):n.id);var c;return{id:String(n.id),label:h,relative:n.relative||null,from:i,to:l,disabled:u,pressed:this.preset===String(n.id)}}).filter(Boolean)}get activePreset(){const t=this.preset;if(!t||!this.range)return null;const e=this.presetItems.find(e=>e.id===t);return e&&!e.disabled?e:null}get startDate(){return D(this.startValue,this.format)}get endDate(){return D(this.endValue,this.format)}get date(){return this.getAttribute("date")||this.getAttribute("value")||""}get value(){return this.range?[this.startValue,this.endValue]:this.date}set value(t){if(Array.isArray(t)){const[e="",a=""]=t;return void this.setState({date:e||"",startValue:e||"",endValue:a||""})}if(t&&"object"==typeof t){const e=t.start||t.startValue||t.date||"",a=t.end||t.endValue||"";return void this.setState({date:t.date||e||"",startValue:e,endValue:a})}this.setState({date:t?String(t):"",startValue:"",endValue:""})}setMaxDate(){return D(this.maxDate,this.format)}setMinDate(){return D(this.minDate,this.format)}get maxDate(){return this.getAttribute("max-date")||""}get minDate(){return this.getAttribute("min-date")||""}set date(t){this.setState({date:t?String(t):""})}get startValue(){const t=this.activePreset;return t?f(t.from):this.getAttribute("start-value")||""}set startValue(t){this.setState({startValue:t?String(t):""})}get endValue(){const t=this.activePreset;return t?f(t.to):this.getAttribute("end-value")||""}set endValue(t){this.setState({endValue:t?String(t):""})}get range(){return this.getBooleanAttr("range",!1)}get input(){return this.getBooleanAttr("input",!0)}get open(){return this.getBooleanAttr("open",!1)}get portal(){return this.getBooleanAttr("portal",!0)}get inputType(){return this.getAttribute("input-type")||"bordered"}get size(){return(0,n.id)(this.getAttribute("size")||this.getAttribute("input-size")||"1","sf-datepicker")}get inputSize(){return this.size}get inputName(){return this.getAttribute("input-name")||this.getAttribute("name")||""}get placeholder(){return this.getAttribute("placeholder")||""}get label(){return this.getAttribute("label")||""}get disabled(){return this.getBooleanAttr("disabled",!1)}get required(){return this.getBooleanAttr("required",!1)}get closeOnSelect(){return this.getBooleanAttr("close-on-select",!0)}get leftIcon(){return this.hasAttribute("icon-start")?this.getAttribute("icon-start"):this.getAttribute("left-icon")||"calendar_today"}get iconStart(){return this.leftIcon}get inputRootClass(){return this.getAttribute("input-root-class")||""}get mask(){return this.getBooleanAttr("mask",!1)}get maskPattern(){return this.getAttribute("mask-pattern")||this.formatToMask(this.format)}get maskLazy(){return!!this.hasAttribute("mask-lazy")&&this.getBooleanAttr("mask-lazy",!1)}get maskPlaceholderChar(){return this.getAttribute("mask-placeholder-char")||"_"}get maskOptions(){return this.getAttribute("mask-options")||""}get year(){const t=this.primaryDate,e=t?t.getFullYear():(new Date).getFullYear();return this.hasAttribute("year")?this.getNumberAttr("year",e):e}set year(t){this.setState({year:null==t||""===t?"":String((0,s.toNumber)(t,(new Date).getFullYear()))})}get month(){const t=this.primaryDate,e=t?t.getMonth():(new Date).getMonth();return this.hasAttribute("month")?k(this.getAttribute("month"),e):e}set month(t){this.setState({month:null==t||""===t?"":String(k(t,(new Date).getMonth()))})}get contextMode(){return this.getEnumAttr("context",["month","year",""],"")}get weekStart(){if(this.hasAttribute("week-start")){const t=this.getNumberAttr("week-start",1);return Number.isInteger(t)&&t>=0&&t<=7?t%7:1}try{const t=new Intl.Locale(this.locale),e="function"==typeof t.getWeekInfo?t.getWeekInfo():t.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 1}get locale(){return x(this.getAttribute("locale"),this)}get format(){return this.getAttribute("format")||"DD.MM.YYYY"}get ariaLabel(){return this.getProp("ariaLabel")||""}get readonly(){return this.range||this.getBooleanAttr("readonly",!1)}get typed(){return!this.readonly&&!this.disabled}get formattedValue(){return b(this.selectedDate,this.format)}get formattedStartValue(){return b(this.startDate,this.format)}get formattedEndValue(){return b(this.endDate,this.format)}get displayValue(){return this.range?this.formattedStartValue&&this.formattedEndValue?`${this.formattedStartValue} - ${this.formattedEndValue}`:this.formattedStartValue||this.formattedEndValue||"":this.formattedValue}get displayDate(){return new Date(this.year,this.month,1)}get isRtl(){return"rtl"===(this.closest("[dir]")?.getAttribute("dir")||document.documentElement?.dir)}get labels(){return t=this,Object.fromEntries(["previousMonth","nextMonth","previousYears","nextYears","chooseMonth","chooseYear","presets","customRange"].map(e=>[e,(0,o.pageText)(T,e,t,"sf-datepicker")]));var t}get weekdays(){return V(this.locale,this.weekStart)}get calendarLabel(){try{return new Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.displayDate)}catch{return`${this.month+1}.${this.year}`}}get activeDate(){const t=v(this.state.activeDate)||this.primaryDate||this.displayDate,e=this.setMinDate(),a=this.setMaxDate();return e&&w(t,e)<0?e:a&&w(t,a)>0?a:t}get normalizedRange(){const t=this.startDate,e=this.endDate;return t&&e?w(t,e)<=0?{startDate:t,endDate:e}:{startDate:e,endDate:t}:{startDate:t,endDate:e}}get days(){const t=(new Date(this.year,this.month,1).getDay()-this.weekStart+7)%7,e=new Date(this.year,this.month,1-t),{startDate:a,endDate:s}=this.normalizedRange,n=Boolean(this.startValue&&this.endValue),r=this.setMinDate(),i=this.setMaxDate(),o=this.activeDate,l=new Date;return Array.from({length:42}).map((t,u)=>{const h=new Date(e.getFullYear(),e.getMonth(),e.getDate()+u),c=h.getTime(),d=Boolean(r&&c<r.getTime()||i&&c>i.getTime());return{date:h,value:f(h),formattedValue:b(h,this.format),label:Y(h,this.locale),day:h.getDate(),today:S(h,l),currentMonth:h.getMonth()===this.month,weekend:[0,6].includes(h.getDay()),disabled:d,selected:this.range?S(h,a)||S(h,s):S(h,this.selectedDate),rangeStart:this.range&&n&&S(h,a),rangeEnd:this.range&&n&&S(h,s),rangeSelected:this.range&&n&&$(h,a,s),tabIndex:!d&&S(h,o)?0:-1}})}get months(){const t=this.setMinDate(),e=this.setMaxDate(),a=t?new Date(t.getFullYear(),t.getMonth(),1):null,s=e?new Date(e.getFullYear(),e.getMonth(),1):null;return Array.from({length:12}).map((t,e)=>{const n=new Date(this.year,e,1).getTime(),r=Boolean(a&&n<a.getTime()||s&&n>s.getTime());return{index:e,label:A(e,this.locale),selected:e===this.month,disabled:r}})}get years(){const t=this.setMinDate(),e=this.setMaxDate(),a=this.yearPageStart;return Array.from({length:p}).map((s,n)=>{const r=a+n;return{year:r,disabled:Boolean(t&&r<t.getFullYear()||e&&r>e.getFullYear()),selected:r===this.year}})}get yearPageStart(){return this.state.yearPageStart??this.getYearPageStart(this.year)}get yearPageEnd(){return this.yearPageStart+p-1}getYearPageStart(t=this.year){const e=(0,s.toNumber)(t,(new Date).getFullYear());return e-e%p}formatToMask=t=>{let e=String(t).replace(/[A-Za-z]/g,"0");return this.range&&(e+=` - ${e}`),e};setContext(t=""){return this.setState({context:t||""}),this}toggleContext(t){const e=this.contextMode===t?"":t,a={context:e};return"year"===e&&(a.yearPageStart=this.getYearPageStart(this.year)),this.setState(a),this}shiftYearPage(t=1){return this.set({yearPageStart:this.yearPageStart+p*t}),this}shiftMonth(t=1){const e=new Date(this.year,this.month+t,1),a=this.setMinDate(),s=this.setMaxDate();return a&&e<new Date(a.getFullYear(),a.getMonth(),1)||s&&e>new Date(s.getFullYear(),s.getMonth(),1)||(this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:f(e)})),this}setActiveDate(t){const e=v(t);return e&&this.state.activeDate!==t?(this.set({activeDate:f(e)}),this):this}moveActiveDate(t){const e=new Date(this.activeDate);e.setDate(e.getDate()+t);const a=this.setMinDate(),s=this.setMaxDate();return a&&w(e,a)<0||s&&w(e,s)>0||(this._focusDateAfterRender=!0,this.setState({year:e.getFullYear(),month:e.getMonth(),context:""}),this.set({activeDate:f(e)})),this}openPanel({focusCalendar:t=!1}={}){return this.disabled?this:(this._focusCalendarOnOpen=t,this.state.activeDate||this.set({activeDate:f(this.activeDate)}),this.open?(this.positionPanel(),this):(this.setState({open:!0}),this))}closePanel({restoreFocus:t=!1}={}){return this.open?(this.setState({open:!1,context:""}),t&&requestAnimationFrame(()=>this._input?.focus?.()),this):this}togglePanel(){return this.open?this.closePanel():this.openPanel()}handleInputChange(t){if(!this.typed)return;"change"===t?.type&&t.stopPropagation();const e=t?.target,a=String(e?.value??"").trim(),s=()=>{const t=e?.querySelector?.("input")||e;t&&"value"in t&&(t.value=this.displayValue)};if(!a){if(!this.date)return;return this.setState({date:"",context:""}),void this.emitChange()}const n=D(a,this.format),r=this.setMinDate(),i=this.setMaxDate(),o=Boolean(n)&&(r&&w(n,r)<0||i&&w(n,i)>0);if(!n||o)return void s();const l=f(n);l!==this.date?(this.setState({year:n.getFullYear(),month:n.getMonth(),date:l,context:""}),this.set({activeDate:l}),this.emitChange()):s()}handleInputInput(t){this.typed&&t?.stopPropagation?.()}handleInputClick(t){t?.preventDefault?.(),t?.stopPropagation?.(),this.openPanel()}handleInputKeydown(t){if(this.typed){if("ArrowDown"!==t.key&&"Enter"!==t.key)return;return t.preventDefault(),"Enter"===t.key?void this.handleInputChange(t):void this.openPanel({focusCalendar:!0})}["ArrowDown","Enter"," "].includes(t.key)&&(t.preventDefault(),this.openPanel({focusCalendar:!0}))}handleDayKeydown(t,e){const a=this.isRtl?-1:1,s={ArrowLeft:-a,ArrowRight:a,ArrowUp:-7,ArrowDown:7};if(Object.prototype.hasOwnProperty.call(s,t.key))return t.preventDefault(),void this.moveActiveDate(s[t.key]);if("Home"===t.key||"End"===t.key){t.preventDefault();const a=((e?.date||this.activeDate).getDay()-this.weekStart+7)%7;return void this.moveActiveDate("Home"===t.key?-a:6-a)}if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault();const e="PageUp"===t.key?-1:1;let a=M(this.activeDate,e);const s=this.setMinDate(),n=this.setMaxDate();s&&w(a,s)<0&&(a=s),n&&w(a,n)>0&&(a=n),this._focusDateAfterRender=!0,this.setState({year:a.getFullYear(),month:a.getMonth()}),this.set({activeDate:f(a)})}}handlePanelClick(t){t?.stopPropagation?.()}handleDocumentClick(t){if(!this.open)return;const e=t.target;this.contains(e)||this.refs.datePickerPanel.value?.contains?.(e)||this.closePanel()}handleDocumentKeydown(t){this.open&&"Escape"===t.key&&!t.defaultPrevented&&(0,l.Hw)(this)&&(t.preventDefault(),t.stopPropagation(),this.contextMode?this.setContext(""):this.closePanel({restoreFocus:!0}))}syncOverlayListeners(){const t=Boolean(this.input&&this.open);if((0,l.Ec)(this,t),t)return document.addEventListener("click",this._documentClickHandler),void document.addEventListener("keydown",this._documentKeydownHandler,!0);this.removeOverlayListeners()}removeOverlayListeners(){(0,l.Ec)(this,!1),document.removeEventListener("click",this._documentClickHandler),document.removeEventListener("keydown",this._documentKeydownHandler,!0),this.stopPanelPosition(),window.removeEventListener("resize",this._viewportHandler),document.removeEventListener("scroll",this._viewportHandler,!0),window.visualViewport?.removeEventListener("resize",this._viewportHandler),window.visualViewport?.removeEventListener("scroll",this._viewportHandler)}positionPanel(){const t=this.refs.datePickerPanel.value,e=this._input?.closest(".sf-input-field")||this._input||this.querySelector("sf-input");if(this.isConnected&&this.input&&this.portal&&this.open&&t?.isConnected&&e)return this._panelAnchor&&this._panelAnchorPanel===t&&this._panelAnchorTrigger===e?void this._panelAnchor.update():(this.stopPanelPosition(),Object.assign(t.style,{overflowY:"auto",zIndex:"var(--sf-z-index-9)"}),this._panelAnchorPanel=t,this._panelAnchorTrigger=e,void(this._panelAnchor=(globalThis.SF?.Position||c()).anchor(e,t,{side:"block-end",align:"start",onPosition:({side:t})=>{const e="block-start"===t;Boolean(this.state.openAbove)!==e&&this.set({openAbove:e})}})));this.stopPanelPosition()}stopPanelPosition(){this._panelAnchor?.stop(),this._panelAnchor=null,this._panelAnchorPanel=null,this._panelAnchorTrigger=null}selectDate(t){return!t?.date||t.disabled?this:this.range?(this.selectRangeDate(t),this):(this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),date:t.value,context:""}),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this)}selectRangeDate(t){if(!this.startValue||this.startValue&&this.endValue)return this.setState({year:t.date.getFullYear(),month:t.date.getMonth(),startValue:t.value,endValue:"",date:t.value,context:"",preset:""}),this.set({activeDate:t.value}),this.emitChange(),this;const e=this.startDate,a={year:t.date.getFullYear(),month:t.date.getMonth(),context:"",preset:""};return e&&w(t.date,e)<0?(a.startValue=t.value,a.endValue=this.startValue,a.date=t.value):(a.endValue=t.value,a.date=this.startValue),this.setState(a),this.set({activeDate:t.value}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}choosePreset(t){if(!t||t.disabled)return this;const e=f(t.from),a=f(t.to);return this.setState({preset:t.id,startValue:e,endValue:a,date:e,year:t.to.getFullYear(),month:t.to.getMonth(),context:""}),this.set({activeDate:a}),this.emitChange(),this.closeOnSelect&&this.closePanel({restoreFocus:!0}),this}chooseCustomRange(){return this.preset&&this.setState({preset:"",startValue:"",endValue:"",date:""}),this._focusDateAfterRender=!0,this.requestComponentUpdate("custom-range"),this}handlePresetKeydown(t){const e={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};if(!(t.key in e)&&"Home"!==t.key&&"End"!==t.key)return;const a=[...t.currentTarget.querySelectorAll("button:not(:disabled)")];if(!a.length)return;t.preventDefault();const s=a.indexOf(t.target);let n="Home"===t.key?0:"End"===t.key?a.length-1:s+e[t.key];!this.isRtl||"ArrowRight"!==t.key&&"ArrowLeft"!==t.key||(n=s-e[t.key]),n=(n+a.length)%a.length,a.forEach((t,e)=>t.setAttribute("tabindex",e===n?"0":"-1")),a[n].focus()}selectMonth(t){return!t||t.disabled||(this.setState({month:t.index,context:""}),this.set({activeDate:f(new Date(this.year,t.index,1))})),this}selectYear(t){if(!t||t.disabled)return this;const e={year:t.year,context:""},a=this.getClosestEnabledMonth(t.year,this.month);return a!==this.month&&(e.month=a),this.setState(e),this.set({activeDate:f(new Date(t.year,a,1))}),this}getClosestEnabledMonth(t,e){const a=this.setMinDate(),s=this.setMaxDate();return a&&t===a.getFullYear()&&e<a.getMonth()?a.getMonth():s&&t===s.getFullYear()&&e>s.getMonth()?s.getMonth():e}emitChange(){const t=this.startValue&&this.endValue?`${this.startValue}/${this.endValue}`:this.startValue||"",e=this.range?{value:[this.startValue,this.endValue],date:t,startValue:this.startValue,endValue:this.endValue,formattedValue:this.displayValue,formattedStartValue:this.formattedStartValue,formattedEndValue:this.formattedEndValue,isoValue:t,startIsoValue:this.startValue,endIsoValue:this.endValue,range:!0,format:this.format,preset:this.activePreset?this.activePreset.relative?{id:this.activePreset.id,relative:this.activePreset.relative}:{id:this.activePreset.id}:null}:{value:this.date,date:this.date,formattedValue:this.formattedValue,isoValue:this.date,range:!1,format:this.format};this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:e})),this.dispatchEvent(new CustomEvent("sf-datepicker-change",{bubbles:!0,composed:!0,detail:e})),this.emitComponentEvent("change",e)}templateContext(){const t=this.getPropsContext();return this.createTemplateContext({...t,component:this,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,selectedDate:this.selectedDate,startDate:this.startDate,endDate:this.endDate,year:this.year,month:this.month,monthLabel:A(this.month,this.locale),calendarLabel:this.calendarLabel,labels:this.labels,weekdays:this.weekdays,panelId:this._panelId,previousIcon:this.isRtl?"chevron_right":"chevron_left",nextIcon:this.isRtl?"chevron_left":"chevron_right",context:this.contextMode,locale:this.locale,days:this.days,presetItems:this.presetItems,months:this.months,years:this.years,yearPageStart:this.yearPageStart,yearPageEnd:this.yearPageEnd,rootClass:this.getRootClass(),rootStyle:this.getRootStyle(),openAbove:Boolean(this.state.openAbove),input:this.input,open:this.open,portal:this.portal,inputType:this.inputType,inputSize:this.inputSize,inputName:this.inputName,placeholder:this.placeholder,label:this.label,ariaLabel:this.ariaLabel,readonly:this.readonly,disabled:this.disabled,required:this.required,leftIcon:this.leftIcon,iconStart:this.leftIcon,inputRootClass:this.inputRootClass,mask:this.mask,maskPattern:this.maskPattern,maskLazy:this.maskLazy,maskPlaceholderChar:this.maskPlaceholderChar,maskOptions:this.maskOptions})}template(){return(0,r.P)(this.templateContext())}afterRender(){this._input=this.refs.input?.value?.querySelector("input")||null,this._input&&(this._input.setAttribute("aria-haspopup","dialog"),this._input.setAttribute("aria-expanded",this.open?"true":"false"),this._input.setAttribute("aria-controls",this._panelId));const t=this.querySelector(".sf-datepicker-month-toggle button"),e=this.querySelector(".sf-datepicker-year-toggle button");t?.setAttribute("aria-expanded","month"===this.contextMode?"true":"false"),e?.setAttribute("aria-expanded","year"===this.contextMode?"true":"false"),this.syncOverlayListeners(),requestAnimationFrame(()=>{if(this.positionPanel(),this._focusCalendarOnOpen||this._focusDateAfterRender){const t=this.querySelector(`.sf-datepicker-day[data-date="${f(this.activeDate)}"]`);t?.focus?.(),this._focusCalendarOnOpen=!1,this._focusDateAfterRender=!1}})}onDisconnected(){this.removeOverlayListeners(),super.onDisconnected()}get data(){return{value:this.value,date:this.date,formattedValue:this.formattedValue,displayValue:this.displayValue,startValue:this.startValue,formattedStartValue:this.formattedStartValue,endValue:this.endValue,formattedEndValue:this.formattedEndValue,range:this.range,format:this.format,year:this.year,month:this.month,context:this.contextMode,maxDate:this.maxDate,minDate:this.minDate,locale:this.locale,input:this.input,open:this.open,portal:this.portal,mask:this.mask,maskPattern:this.maskPattern,maskOptions:this.maskOptions,presets:this.presetItems.map(({id:t,label:e,relative:a,disabled:s})=>({id:t,label:e,relative:a,disabled:s})),preset:this.preset}}}E.define("sf-datepicker"),e()}catch(I){e(I)}})},"77b2f4107e3b"(t,e,a){a.a(t,async(t,s)=>{try{a.d(e,{P:()=>b});var n=a("ddf1cdb42ecc"),r=a("5a8eddcd589d"),i=t([n,r]);[n,r]=i.then?(await i)():i;function o(...t){return t.flat().filter(Boolean).join(" ")}function l(t){return n.html`
2
2
  <div class="sf-datepicker-top flex content-main-between items-cross-center">
3
3
  <sf-icon-button appearance="link" scheme="on-surface" size="1"
4
4
  icon=${t.previousIcon} aria-label=${t.labels.previousYears}
@@ -9,7 +9,7 @@
9
9
  <sf-icon-button appearance="link" scheme="on-surface" size="1"
10
10
  icon=${t.nextIcon} aria-label=${t.labels.nextYears}
11
11
  @click=${()=>t.component.shiftYearPage(1)}></sf-icon-button>
12
- </div>`}function h(t){return"year"===t.context?l(t):n.html`
12
+ </div>`}function u(t){return"year"===t.context?l(t):n.html`
13
13
  <div class="sf-datepicker-top grid items-cross-center">
14
14
  <sf-icon-button appearance="link" scheme="on-surface" size="1"
15
15
  icon=${t.previousIcon} aria-label=${t.labels.previousMonth}
@@ -27,7 +27,7 @@
27
27
  <sf-icon-button appearance="link" scheme="on-surface" size="1"
28
28
  icon=${t.nextIcon} aria-label=${t.labels.nextMonth}
29
29
  @click=${()=>t.component.shiftMonth(1)}></sf-icon-button>
30
- </div>`}function u(t){return n.html`
30
+ </div>`}function h(t){return n.html`
31
31
  <div class="sf-datepicker-context absolute top-0 bottom-0 inline-start-0 inline-end-0 grid grid-col-3 content-cross-start items-cross-start overflow-auto gap-1/4"
32
32
  aria-label=${t.labels.chooseMonth}>
33
33
  ${t.months.map(e=>n.html`
@@ -36,7 +36,7 @@
36
36
  type="button" @click=${()=>t.component.selectMonth(e)}>
37
37
  <span class="sf-datepicker-text-date">${e.label}</span>
38
38
  </button>`)}
39
- </div>`}function d(t){return n.html`
39
+ </div>`}function c(t){return n.html`
40
40
  <div class="sf-datepicker-context absolute top-0 bottom-0 inline-start-0 inline-end-0 grid grid-col-3 content-cross-start items-cross-start overflow-auto gap-1/4"
41
41
  aria-label=${t.labels.chooseYear}>
42
42
  ${t.years.map(e=>n.html`
@@ -45,7 +45,7 @@
45
45
  @click=${()=>t.component.selectYear(e)}>
46
46
  <span class="sf-datepicker-text-date">${e.year}</span>
47
47
  </button>`)}
48
- </div>`}function c(t){return"month"===t.context?u(t):"year"===t.context?d(t):n.nothing}function p(t){return n.html`
48
+ </div>`}function d(t){return"month"===t.context?h(t):"year"===t.context?c(t):n.nothing}function p(t){return n.html`
49
49
  <sf-input class="sf-datepicker-input" ${(0,r.ref)(t.component.refs.input)}
50
50
  appearance=${t.inputType} size=${t.inputSize}
51
51
  label=${t.label||n.nothing} name=${t.inputName||n.nothing}
@@ -86,12 +86,12 @@
86
86
  @click=${e=>t.component.handlePanelClick(e)}>
87
87
  ${m(t)}
88
88
  <div class="sf-datepicker-container flex flex-col">
89
- ${h(t)}
89
+ ${u(t)}
90
90
  <div class="sf-datepicker-weekdays grid grid-col-7" aria-hidden="true">
91
91
  ${t.weekdays.map(t=>n.html`<span class="sf-datepicker-weekday">${t}</span>`)}
92
92
  </div>
93
93
  <div class="sf-datepicker-main relative">
94
- ${c(t)}
94
+ ${d(t)}
95
95
  <div class="sf-datepicker-grid grid grid-col-7">
96
96
  ${t.days.map(e=>g(e,t))}
97
97
  </div>
@@ -102,4 +102,4 @@
102
102
  ${(0,r.ref)(t.component.refs.datePickerRoot)} data-portal=${t.portal?"true":"false"}>
103
103
  ${p(t)}
104
104
  ${t.open?f(t):n.nothing}
105
- </div>`:f(t)}s()}catch(y){s(y)}})},"5a8eddcd589d"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit/directives/ref.js"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("lit/directives/ref.js")),{once:!0}))},ddf1cdb42ecc(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("lit")),{once:!0}))},"0d662e4d7d63"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("page-language"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("page-language")),{once:!0}))},"5c1dc214bb5e"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("position"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("position")),{once:!0}))},fbe0570fcc69(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("smart-base"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("smart-base")),{once:!0}))}};const e={};function a(s){const n=e[s];if(void 0!==n)return n.exports;const r=e[s]={exports:{}};return t[s](r,r.exports,a),r.exports}(()=>{const t="function"==typeof Symbol,e=t?Symbol("webpack queues"):"__webpack_queues__",s=t?Symbol("webpack exports"):"__webpack_exports__",n=t?Symbol("webpack error"):"__webpack_error__",r=t=>{t?.d<1&&(t.d=1,t.forEach(t=>t.r--),t.forEach(t=>t.r--?t.r++:t()))};a.a=(t,a,i)=>{let o;i&&((o=[]).d=-1);const l=new Set,h=t.exports;let u,d,c;const p=new Promise((t,e)=>{c=e,d=t});p[s]=h,p[e]=t=>(o&&t(o),l.forEach(t),p.catch(t=>{})),t.exports=p;a(t=>{let a;u=(t=>t.map(t=>{if(null!==t&&"object"==typeof t){if(t[e])return t;if(t.then){const a=[];a.d=0,t.then(t=>{i[s]=t,r(a)},t=>{i[n]=t,r(a)});const i={};return i[e]=t=>t(a),i}}const a={};return a[e]=t=>{},a[s]=t,a}))(t);const i=()=>u.map(t=>{if(t[n])throw t[n];return t[s]}),h=new Promise(t=>{a=()=>t(i),a.r=0;const s=t=>t!==o&&!l.has(t)&&(l.add(t),t&&!t.d&&(a.r++,t.push(a)));u.map(t=>t[e](s))});return a.r?h:i()},t=>(t?c(p[n]=t):d(h),r(o))),o?.d<0&&(o.d=0)}})(),a.n=t=>{const e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{if(Array.isArray(e))for(var s=0;s<e.length;){var n=e[s++],r=e[s++];a.o(t,n)?0===r&&s++:0===r?Object.defineProperty(t,n,{enumerable:!0,value:e[s++]}):Object.defineProperty(t,n,{enumerable:!0,get:r})}else for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);a("b9b65955223a")})();
105
+ </div>`:f(t)}s()}catch(y){s(y)}})},"5a8eddcd589d"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit/directives/ref.js"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("lit/directives/ref.js")),{once:!0}))},ddf1cdb42ecc(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("lit")),{once:!0}))},"0d662e4d7d63"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("page-language"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("page-language")),{once:!0}))},"5c1dc214bb5e"(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("position"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("position")),{once:!0}))},fbe0570fcc69(t){t.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("smart-base"):new Promise(t=>globalThis.addEventListener("sf-runtime-ready",()=>t(globalThis.SF.runtimeModule("smart-base")),{once:!0}))}};const e={};function a(s){const n=e[s];if(void 0!==n)return n.exports;const r=e[s]={exports:{}};return t[s](r,r.exports,a),r.exports}(()=>{const t="function"==typeof Symbol,e=t?Symbol("webpack queues"):"__webpack_queues__",s=t?Symbol("webpack exports"):"__webpack_exports__",n=t?Symbol("webpack error"):"__webpack_error__",r=t=>{t?.d<1&&(t.d=1,t.forEach(t=>t.r--),t.forEach(t=>t.r--?t.r++:t()))};a.a=(t,a,i)=>{let o;i&&((o=[]).d=-1);const l=new Set,u=t.exports;let h,c,d;const p=new Promise((t,e)=>{d=e,c=t});p[s]=u,p[e]=t=>(o&&t(o),l.forEach(t),p.catch(t=>{})),t.exports=p;a(t=>{let a;h=(t=>t.map(t=>{if(null!==t&&"object"==typeof t){if(t[e])return t;if(t.then){const a=[];a.d=0,t.then(t=>{i[s]=t,r(a)},t=>{i[n]=t,r(a)});const i={};return i[e]=t=>t(a),i}}const a={};return a[e]=t=>{},a[s]=t,a}))(t);const i=()=>h.map(t=>{if(t[n])throw t[n];return t[s]}),u=new Promise(t=>{a=()=>t(i),a.r=0;const s=t=>t!==o&&!l.has(t)&&(l.add(t),t&&!t.d&&(a.r++,t.push(a)));h.map(t=>t[e](s))});return a.r?u:i()},t=>(t?d(p[n]=t):c(u),r(o))),o?.d<0&&(o.d=0)}})(),a.n=t=>{const e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{if(Array.isArray(e))for(var s=0;s<e.length;){var n=e[s++],r=e[s++];a.o(t,n)?0===r&&s++:0===r?Object.defineProperty(t,n,{enumerable:!0,value:e[s++]}):Object.defineProperty(t,n,{enumerable:!0,get:r})}else for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);a("b9b65955223a")})();
@@ -578,7 +578,7 @@
578
578
  "source_artifacts": [
579
579
  {
580
580
  "path": "src/smart/datepicker/index.js",
581
- "sha256": "30dd094383fc895716752605ed199476f5259a6dbf363e38decf5c9b1e958499"
581
+ "sha256": "c53d7dbd5777a4d6810986deca039ff4d4d79872685452e3164e9a97470f6afd"
582
582
  },
583
583
  {
584
584
  "path": "src/smart/datepicker/js/templates/default.js",
@@ -590,7 +590,7 @@
590
590
  },
591
591
  {
592
592
  "path": "src/smart/datepicker/docs/smart-datepicker-guide.md",
593
- "sha256": "d1158de65cf63c2d8d1851a490c7c6727c4e6383d0c5fda2d5d3a41b2dac8de1"
593
+ "sha256": "4618d75ee7e3f01ed2405ebfa2ed59704815cef34234b957672173d7a733d582"
594
594
  }
595
595
  ],
596
596
  "generated_runtime": [