diff --git a/resources/dist/build/assets/statamic-structured-data-9a9eb249.js b/resources/dist/build/assets/statamic-structured-data-c2cc3bfe.js similarity index 84% rename from resources/dist/build/assets/statamic-structured-data-9a9eb249.js rename to resources/dist/build/assets/statamic-structured-data-c2cc3bfe.js index 0f67a79..5885674 100644 --- a/resources/dist/build/assets/statamic-structured-data-9a9eb249.js +++ b/resources/dist/build/assets/statamic-structured-data-c2cc3bfe.js @@ -1,8 +1,8 @@ -function _t(a,t,e,n,i,r,o,s){var l=typeof a=="function"?a.options:a;t&&(l.render=t,l.staticRenderFns=e,l._compiled=!0),n&&(l.functional=!0),r&&(l._scopeId="data-v-"+r);var u;if(o?(u=function(f){f=f||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!f&&typeof __VUE_SSR_CONTEXT__<"u"&&(f=__VUE_SSR_CONTEXT__),i&&i.call(this,f),f&&f._registeredComponents&&f._registeredComponents.add(o)},l._ssrRegister=u):i&&(u=s?function(){i.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:i),u)if(l.functional){l._injectStyles=u;var c=l.render;l.render=function(b,v){return u.call(v),c(b,v)}}else{var d=l.beforeCreate;l.beforeCreate=d?[].concat(d,u):[u]}return{exports:a,options:l}}const sn={name:"StructuredDataObject",props:{value:{type:Object,default:()=>({specialProps:{type:"",id:""},fields:[]})},baseUrl:{type:String,required:!0},parentType:{type:String,default:""},fieldKey:{type:String,default:""}},data(){return{objectData:JSON.parse(JSON.stringify(this.value))}},computed:{suggestedId(){return this.objectData.specialProps.type?`{{ site:url }}/#${this.objectData.specialProps.type}`:""},selectOptions(){return[{value:"string",label:"String"},{value:"numeric",label:"Numeric"},{value:"array",label:"Array"},{value:"object",label:"Object"}]}},watch:{objectData:{deep:!0,handler(a){const t=JSON.stringify(a),e=JSON.stringify(this.value);t!==e&&this.$emit("input",JSON.parse(JSON.stringify(a)))}},"objectData.specialProps.type"(a){!this.objectData.specialProps.id&&a&&this.useDefaultId()},value:{deep:!0,handler(a){const t=JSON.stringify(a),e=JSON.stringify(this.objectData);t!==e&&(this.objectData=JSON.parse(JSON.stringify(a)))}}},methods:{addField(){this.objectData.fields.push({key:"",type:"string",value:"",values:[],fields:[]})},removeField(a){this.objectData.fields.splice(a,1)},addArrayValue(a){a.values||(a.values=[]),a.values.push("")},removeArrayValue(a,t){a.values.splice(t,1)},validateKey(a){a.key=a.key.replace(/[^a-zA-Z0-9@:-]/g,"")},useDefaultId(){this.objectData.specialProps.id=this.suggestedId},handleTypeChange(a){a.type==="object"?this.$set(a,"value",{specialProps:{type:"",id:""},fields:[]}):a.type==="array"?a.values=[]:a.value=""}}};var ln=function(){var t=this,e=t._self._c;return e("div",{staticClass:"structured-data-object"},[e("div",{staticClass:"mb-4"},[e("div",{staticClass:"mb-2"},[e("label",{staticClass:"block mb-1"},[t._v("@type")]),e("input",{directives:[{name:"model",rawName:"v-model",value:t.objectData.specialProps.type,expression:"objectData.specialProps.type"}],staticClass:"input-text",attrs:{type:"text",placeholder:"e.g. Organization, Product, BlogPosting"},domProps:{value:t.objectData.specialProps.type},on:{input:function(n){n.target.composing||t.$set(t.objectData.specialProps,"type",n.target.value)}}})]),e("div",{staticClass:"mb-2"},[e("label",{staticClass:"block mb-1"},[t._v("@id")]),e("div",{staticClass:"flex"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.objectData.specialProps.id,expression:"objectData.specialProps.id"}],staticClass:"input-text flex-1",attrs:{type:"text",placeholder:t.suggestedId},domProps:{value:t.objectData.specialProps.id},on:{input:function(n){n.target.composing||t.$set(t.objectData.specialProps,"id",n.target.value)}}}),e("button",{staticClass:"btn ml-2",on:{click:t.useDefaultId}},[t._v("Use Default")])])])]),e("div",[t._l(t.objectData.fields,function(n,i){return e("div",{key:i,staticClass:"mb-4 border-b pb-4"},[e("div",{staticClass:"flex items-start gap-2"},[e("div",{staticClass:"flex-1"},[e("label",{staticClass:"block mb-1"},[t._v("Key")]),e("input",{directives:[{name:"model",rawName:"v-model",value:n.key,expression:"field.key"}],staticClass:"input-text",attrs:{type:"text"},domProps:{value:n.key},on:{input:[function(r){r.target.composing||t.$set(n,"key",r.target.value)},function(r){return t.validateKey(n)}]}})]),e("div",{staticClass:"w-32"},[e("label",{staticClass:"block mb-1"},[t._v("Type")]),e("v-select",{attrs:{options:t.selectOptions},on:{input:r=>{n.type=r.value,t.handleTypeChange(n)}},model:{value:n.type,callback:function(r){t.$set(n,"type",r)},expression:"field.type"}})],1),e("button",{staticClass:"btn-close mt-6",on:{click:function(r){return t.removeField(i)}}},[t._v("×")])]),e("div",{staticClass:"mt-2"},[n.type==="string"?e("div",[e("input",{directives:[{name:"model",rawName:"v-model",value:n.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"text"},domProps:{value:n.value},on:{input:function(r){r.target.composing||t.$set(n,"value",r.target.value)}}})]):n.type==="numeric"?e("div",[e("input",{directives:[{name:"model",rawName:"v-model",value:n.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"number"},domProps:{value:n.value},on:{input:function(r){r.target.composing||t.$set(n,"value",r.target.value)}}})]):n.type==="array"?e("div",{staticClass:"space-y-2"},[t._l(n.values,function(r,o){return e("div",{key:o,staticClass:"flex gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:n.values[o],expression:"field.values[valueIndex]"}],staticClass:"input-text flex-1",attrs:{type:"text"},domProps:{value:n.values[o]},on:{input:function(s){s.target.composing||t.$set(n.values,o,s.target.value)}}}),e("button",{staticClass:"btn-close",on:{click:function(s){return t.removeArrayValue(n,o)}}},[t._v("×")])])}),e("button",{staticClass:"btn",on:{click:function(r){return t.addArrayValue(n)}}},[t._v("Add Value")])],2):n.type==="object"?e("div",{staticClass:"mt-2 border rounded p-4"},[e("structured-data-object",{attrs:{"base-url":t.baseUrl,"parent-type":t.objectData.specialProps.type,"field-key":n.key},model:{value:n.value,callback:function(r){t.$set(n,"value",r)},expression:"field.value"}})],1):t._e()])])}),e("button",{staticClass:"btn",on:{click:t.addField}},[t._v("Add Property")])],2)])},un=[],cn=_t(sn,ln,un,!1,null,null,null,null);const We=cn.exports,dn={name:"PresetModal",props:{visible:{type:Boolean,default:!1},presets:{type:Array,default:()=>[]},hasExistingSchemas:{type:Boolean,default:!1}},data(){return{selectedPreset:null}},watch:{visible:{immediate:!0,handler(a){a?this.lockBodyScroll():(this.unlockBodyScroll(),this.selectedPreset=null)}}},beforeDestroy(){this.unlockBodyScroll()},methods:{lockBodyScroll(){document.body.style.overflow="hidden"},unlockBodyScroll(){document.body.style.overflow=""},close(){this.selectedPreset=null,this.$emit("close")},selectPreset(a){this.selectedPreset=a},goBack(){this.selectedPreset=null},handleAction(a){this.$emit("preset-selected",{preset:this.selectedPreset,action:a}),this.close()}}};var fn=function(){var t=this,e=t._self._c;return t.visible?e("div",{staticClass:"fixed inset-0 bg-gray-900 bg-opacity-75 flex justify-center items-center p-4",staticStyle:{"z-index":"9999"},on:{click:function(n){return n.target!==n.currentTarget?null:t.close.apply(null,arguments)}}},[e("div",{staticClass:"bg-white dark:bg-gray-800 rounded-lg w-full max-w-xl flex flex-col shadow-2xl",staticStyle:{"max-height":"60vh"}},[e("div",{staticClass:"flex justify-between items-center px-6 py-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0"},[e("h3",{staticClass:"font-bold text-lg text-gray-900 dark:text-white"},[t._v(t._s(t.__("Add Preset")))]),e("button",{staticClass:"text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 text-2xl leading-none bg-transparent border-0 cursor-pointer transition-colors",on:{click:t.close}},[t._v(" × ")])]),e("div",{staticClass:"px-6 py-4 overflow-y-auto flex-1 min-h-0"},[t.selectedPreset?e("div",{staticClass:"preset-actions"},[e("div",{staticClass:"mb-4 p-3 bg-blue-50 dark:bg-blue-900/20 rounded border border-blue-200 dark:border-blue-800"},[e("h4",{staticClass:"font-semibold text-blue-800 dark:text-blue-200"},[t._v(t._s(t.selectedPreset.name))]),e("p",{staticClass:"text-sm text-blue-600 dark:text-blue-300"},[t._v(t._s(t.selectedPreset.description))])]),t.hasExistingSchemas?e("div",{staticClass:"action-selection"},[e("p",{staticClass:"text-gray-700 dark:text-gray-200 mb-4"},[t._v(t._s(t.__("You have existing schemas. How would you like to add this preset?")))]),e("div",{staticClass:"flex flex-col gap-3"},[e("button",{staticClass:"border border-gray-200 dark:border-gray-700 rounded-md p-4 text-left cursor-pointer transition-all duration-200 bg-white dark:bg-gray-800 w-full hover:border-green-500 hover:shadow-md hover:shadow-green-500/10 dark:hover:border-green-400",on:{click:function(n){return t.handleAction("merge")}}},[e("div",{staticClass:"flex flex-col gap-1"},[e("div",{staticClass:"font-semibold text-gray-700 dark:text-gray-200"},[t._v(t._s(t.__("Merge (Recommended)")))]),e("div",{staticClass:"text-sm text-gray-600 dark:text-gray-300"},[t._v(t._s(t.__("Add this preset as an additional schema alongside your existing ones")))])])]),e("button",{staticClass:"border border-gray-200 dark:border-gray-700 rounded-md p-4 text-left cursor-pointer transition-all duration-200 bg-white dark:bg-gray-800 w-full hover:border-amber-500 hover:shadow-md hover:shadow-amber-500/10 dark:hover:border-amber-400",on:{click:function(n){return t.handleAction("override")}}},[e("div",{staticClass:"flex flex-col gap-1"},[e("div",{staticClass:"font-semibold text-gray-700 dark:text-gray-200"},[t._v(t._s(t.__("Override")))]),e("div",{staticClass:"text-sm text-gray-600 dark:text-gray-300"},[t._v(t._s(t.__("Replace all existing schemas with this preset")))])])])])]):e("div",{staticClass:"no-existing-schemas"},[e("p",{staticClass:"text-gray-600 dark:text-gray-300 mb-4"},[t._v(t._s(t.__("This preset will be added as your first schema.")))]),e("button",{staticClass:"px-6 py-3 bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white border-0 rounded cursor-pointer font-medium transition-all duration-200 w-full",on:{click:function(n){return t.handleAction("add")}}},[t._v(" "+t._s(t.__("Add Preset"))+" ")])])]):e("div",{staticClass:"preset-selection"},[e("p",{staticClass:"text-gray-600 dark:text-gray-300 mb-4"},[t._v(t._s(t.__("Choose a preset to add to your schema:")))]),e("div",{staticClass:"grid grid-cols-1 gap-3"},t._l(t.presets,function(n){return e("div",{key:n.name,staticClass:"border border-gray-200 dark:border-gray-700 rounded-md p-3 cursor-pointer transition-all duration-200 hover:border-blue-500 hover:shadow-sm hover:shadow-blue-500/10 dark:hover:border-blue-400 bg-white dark:bg-gray-800",on:{click:function(i){return t.selectPreset(n)}}},[e("div",{staticClass:"flex justify-between items-start"},[e("div",{staticClass:"flex-1"},[e("h4",{staticClass:"font-semibold text-gray-900 dark:text-white text-sm"},[t._v(t._s(n.name))]),e("p",{staticClass:"text-xs text-gray-600 dark:text-gray-300 mt-1"},[t._v(t._s(n.description))]),e("div",{staticClass:"mt-2"},[e("div",{staticClass:"text-xs text-gray-500 dark:text-gray-400 mb-1"},[t._v(t._s(t.__("Fields:")))]),e("div",{staticClass:"flex flex-wrap gap-1"},[t._l(n.schema.fields.slice(0,3),function(i){return e("span",{key:i.key,staticClass:"bg-blue-50 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 px-1.5 py-0.5 rounded text-[9px] font-medium"},[t._v(" "+t._s(i.key)+" ")])}),n.schema.fields.length>3?e("span",{staticClass:"bg-gray-100 dark:bg-gray-600 text-gray-600 dark:text-gray-300 px-1.5 py-0.5 rounded text-[9px]"},[t._v(" +"+t._s(n.schema.fields.length-3)+" ")]):t._e()],2)])]),e("div",{staticClass:"bg-gray-100 dark:bg-gray-600 text-gray-700 dark:text-gray-200 px-2 py-1 rounded text-xs font-medium ml-2"},[t._v(" "+t._s(n.schema.specialProps.type)+" ")])])])}),0)])]),e("div",{staticClass:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex justify-end flex-shrink-0"},[t.selectedPreset?e("button",{staticClass:"mr-2 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 cursor-pointer transition-all duration-200 hover:bg-gray-50 dark:hover:bg-gray-600 text-sm",on:{click:t.goBack}},[t._v(" "+t._s(t.__("Back"))+" ")]):t._e(),e("button",{staticClass:"px-3 py-2 border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 cursor-pointer transition-all duration-200 hover:bg-gray-50 dark:hover:bg-gray-600 text-sm",on:{click:t.close}},[t._v(" "+t._s(t.__("Cancel"))+" ")])])])]):t._e()},pn=[],vn=_t(dn,fn,pn,!1,null,null,null,null);const hn=vn.exports;function se(a){const t={};if(a.specialProps&&(a.specialProps.context&&(t["@context"]=a.specialProps.context),a.specialProps.type&&(t["@type"]=a.specialProps.type),a.specialProps.id&&(t["@id"]=a.specialProps.id)),a.fields&&Array.isArray(a.fields))for(const e of a.fields)e.key&&(e.type==="array"&&e.values?t[e.key]=e.values:e.type==="object"&&e.value?t[e.key]=se(e.value):e.type==="object_array"&&e.values?t[e.key]=e.values.map(n=>se(n)):t[e.key]=e.value??null);return t}function je(a,t=2){try{if(Array.isArray(a)){const n=a.map(i=>se(i));return JSON.stringify(n,null,t)}const e=se(a);return JSON.stringify(e,null,t)}catch{return JSON.stringify(a,null,t)}}var gn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mn(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function bn(a){if(a.__esModule)return a;var t=a.default;if(typeof t=="function"){var e=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(a).forEach(function(n){var i=Object.getOwnPropertyDescriptor(a,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return a[n]}})}),e}var Ye={exports:{}};/**! +function Ft(a,t,e,n,i,r,o,s){var l=typeof a=="function"?a.options:a;t&&(l.render=t,l.staticRenderFns=e,l._compiled=!0),n&&(l.functional=!0),r&&(l._scopeId="data-v-"+r);var u;if(o?(u=function(f){f=f||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!f&&typeof __VUE_SSR_CONTEXT__<"u"&&(f=__VUE_SSR_CONTEXT__),i&&i.call(this,f),f&&f._registeredComponents&&f._registeredComponents.add(o)},l._ssrRegister=u):i&&(u=s?function(){i.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:i),u)if(l.functional){l._injectStyles=u;var c=l.render;l.render=function(b,v){return u.call(v),c(b,v)}}else{var d=l.beforeCreate;l.beforeCreate=d?[].concat(d,u):[u]}return{exports:a,options:l}}const sn={name:"StructuredDataObject",props:{value:{type:Object,default:()=>({specialProps:{type:"",id:""},fields:[]})},baseUrl:{type:String,required:!0},parentType:{type:String,default:""},fieldKey:{type:String,default:""}},data(){return{objectData:JSON.parse(JSON.stringify(this.value))}},computed:{suggestedId(){return this.objectData.specialProps.type?`{{ site:url }}/#${this.objectData.specialProps.type}`:""},selectOptions(){return[{value:"string",label:"String"},{value:"numeric",label:"Numeric"},{value:"array",label:"Array"},{value:"object",label:"Object"}]}},watch:{objectData:{deep:!0,handler(a){const t=JSON.stringify(a),e=JSON.stringify(this.value);t!==e&&this.$emit("input",JSON.parse(JSON.stringify(a)))}},"objectData.specialProps.type"(a){!this.objectData.specialProps.id&&a&&this.useDefaultId()},value:{deep:!0,handler(a){const t=JSON.stringify(a),e=JSON.stringify(this.objectData);t!==e&&(this.objectData=JSON.parse(JSON.stringify(a)))}}},methods:{addField(){this.objectData.fields.push({key:"",type:"string",value:"",values:[],fields:[]})},removeField(a){this.objectData.fields.splice(a,1)},addArrayValue(a){a.values||(a.values=[]),a.values.push("")},removeArrayValue(a,t){a.values.splice(t,1)},validateKey(a){a.key=a.key.replace(/[^a-zA-Z0-9@:-]/g,"")},useDefaultId(){this.objectData.specialProps.id=this.suggestedId},handleTypeChange(a){a.type==="object"?this.$set(a,"value",{specialProps:{type:"",id:""},fields:[]}):a.type==="array"?a.values=[]:a.value=""}}};var ln=function(){var t=this,e=t._self._c;return e("div",{staticClass:"structured-data-object"},[e("div",{staticClass:"mb-4"},[e("div",{staticClass:"mb-2"},[e("label",{staticClass:"block mb-1"},[t._v("@type")]),e("input",{directives:[{name:"model",rawName:"v-model",value:t.objectData.specialProps.type,expression:"objectData.specialProps.type"}],staticClass:"input-text",attrs:{type:"text",placeholder:"e.g. Organization, Product, BlogPosting"},domProps:{value:t.objectData.specialProps.type},on:{input:function(n){n.target.composing||t.$set(t.objectData.specialProps,"type",n.target.value)}}})]),e("div",{staticClass:"mb-2"},[e("label",{staticClass:"block mb-1"},[t._v("@id")]),e("div",{staticClass:"flex"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.objectData.specialProps.id,expression:"objectData.specialProps.id"}],staticClass:"input-text flex-1",attrs:{type:"text",placeholder:t.suggestedId},domProps:{value:t.objectData.specialProps.id},on:{input:function(n){n.target.composing||t.$set(t.objectData.specialProps,"id",n.target.value)}}}),e("button",{staticClass:"btn ml-2",on:{click:t.useDefaultId}},[t._v("Use Default")])])])]),e("div",[t._l(t.objectData.fields,function(n,i){return e("div",{key:i,staticClass:"mb-4 border-b pb-4"},[e("div",{staticClass:"flex items-start gap-2"},[e("div",{staticClass:"flex-1"},[e("label",{staticClass:"block mb-1"},[t._v("Key")]),e("input",{directives:[{name:"model",rawName:"v-model",value:n.key,expression:"field.key"}],staticClass:"input-text",attrs:{type:"text"},domProps:{value:n.key},on:{input:[function(r){r.target.composing||t.$set(n,"key",r.target.value)},function(r){return t.validateKey(n)}]}})]),e("div",{staticClass:"w-32"},[e("label",{staticClass:"block mb-1"},[t._v("Type")]),e("v-select",{attrs:{options:t.selectOptions},on:{input:r=>{n.type=r.value,t.handleTypeChange(n)}},model:{value:n.type,callback:function(r){t.$set(n,"type",r)},expression:"field.type"}})],1),e("button",{staticClass:"btn-close mt-6",on:{click:function(r){return t.removeField(i)}}},[t._v("×")])]),e("div",{staticClass:"mt-2"},[n.type==="string"?e("div",[e("input",{directives:[{name:"model",rawName:"v-model",value:n.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"text"},domProps:{value:n.value},on:{input:function(r){r.target.composing||t.$set(n,"value",r.target.value)}}})]):n.type==="numeric"?e("div",[e("input",{directives:[{name:"model",rawName:"v-model",value:n.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"number"},domProps:{value:n.value},on:{input:function(r){r.target.composing||t.$set(n,"value",r.target.value)}}})]):n.type==="array"?e("div",{staticClass:"space-y-2"},[t._l(n.values,function(r,o){return e("div",{key:o,staticClass:"flex gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:n.values[o],expression:"field.values[valueIndex]"}],staticClass:"input-text flex-1",attrs:{type:"text"},domProps:{value:n.values[o]},on:{input:function(s){s.target.composing||t.$set(n.values,o,s.target.value)}}}),e("button",{staticClass:"btn-close",on:{click:function(s){return t.removeArrayValue(n,o)}}},[t._v("×")])])}),e("button",{staticClass:"btn",on:{click:function(r){return t.addArrayValue(n)}}},[t._v("Add Value")])],2):n.type==="object"?e("div",{staticClass:"mt-2 border rounded p-4"},[e("structured-data-object",{attrs:{"base-url":t.baseUrl,"parent-type":t.objectData.specialProps.type,"field-key":n.key},model:{value:n.value,callback:function(r){t.$set(n,"value",r)},expression:"field.value"}})],1):t._e()])])}),e("button",{staticClass:"btn",on:{click:t.addField}},[t._v("Add Property")])],2)])},un=[],cn=Ft(sn,ln,un,!1,null,null,null,null);const Xe=cn.exports,dn={name:"PresetModal",props:{visible:{type:Boolean,default:!1},presets:{type:Array,default:()=>[]},hasExistingSchemas:{type:Boolean,default:!1}},data(){return{selectedPreset:null}},watch:{visible:{immediate:!0,handler(a){a?this.lockBodyScroll():(this.unlockBodyScroll(),this.selectedPreset=null)}}},beforeDestroy(){this.unlockBodyScroll()},methods:{lockBodyScroll(){document.body.style.overflow="hidden"},unlockBodyScroll(){document.body.style.overflow=""},close(){this.selectedPreset=null,this.$emit("close")},selectPreset(a){this.selectedPreset=a},goBack(){this.selectedPreset=null},handleAction(a){this.$emit("preset-selected",{preset:this.selectedPreset,action:a}),this.close()}}};var fn=function(){var t=this,e=t._self._c;return t.visible?e("div",{staticClass:"fixed inset-0 bg-gray-900 bg-opacity-75 flex justify-center items-center p-4",staticStyle:{"z-index":"9999"},on:{click:function(n){return n.target!==n.currentTarget?null:t.close.apply(null,arguments)}}},[e("div",{staticClass:"bg-white dark:bg-gray-800 rounded-lg w-full max-w-xl flex flex-col shadow-2xl",staticStyle:{"max-height":"60vh"}},[e("div",{staticClass:"flex justify-between items-center px-6 py-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0"},[e("h3",{staticClass:"font-bold text-lg text-gray-900 dark:text-white"},[t._v(t._s(t.__("Add Preset")))]),e("button",{staticClass:"text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 text-2xl leading-none bg-transparent border-0 cursor-pointer transition-colors",on:{click:t.close}},[t._v(" × ")])]),e("div",{staticClass:"px-6 py-4 overflow-y-auto flex-1 min-h-0"},[t.selectedPreset?e("div",{staticClass:"preset-actions"},[e("div",{staticClass:"mb-4 p-3 bg-blue-50 dark:bg-blue-900/20 rounded border border-blue-200 dark:border-blue-800"},[e("h4",{staticClass:"font-semibold text-blue-800 dark:text-blue-200"},[t._v(t._s(t.selectedPreset.name))]),e("p",{staticClass:"text-sm text-blue-600 dark:text-blue-300"},[t._v(t._s(t.selectedPreset.description))])]),t.hasExistingSchemas?e("div",{staticClass:"action-selection"},[e("p",{staticClass:"text-gray-700 dark:text-gray-200 mb-4"},[t._v(t._s(t.__("You have existing schemas. How would you like to add this preset?")))]),e("div",{staticClass:"flex flex-col gap-3"},[e("button",{staticClass:"border border-gray-200 dark:border-gray-700 rounded-md p-4 text-left cursor-pointer transition-all duration-200 bg-white dark:bg-gray-800 w-full hover:border-green-500 hover:shadow-md hover:shadow-green-500/10 dark:hover:border-green-400",on:{click:function(n){return t.handleAction("merge")}}},[e("div",{staticClass:"flex flex-col gap-1"},[e("div",{staticClass:"font-semibold text-gray-700 dark:text-gray-200"},[t._v(t._s(t.__("Merge (Recommended)")))]),e("div",{staticClass:"text-sm text-gray-600 dark:text-gray-300"},[t._v(t._s(t.__("Add this preset as an additional schema alongside your existing ones")))])])]),e("button",{staticClass:"border border-gray-200 dark:border-gray-700 rounded-md p-4 text-left cursor-pointer transition-all duration-200 bg-white dark:bg-gray-800 w-full hover:border-amber-500 hover:shadow-md hover:shadow-amber-500/10 dark:hover:border-amber-400",on:{click:function(n){return t.handleAction("override")}}},[e("div",{staticClass:"flex flex-col gap-1"},[e("div",{staticClass:"font-semibold text-gray-700 dark:text-gray-200"},[t._v(t._s(t.__("Override")))]),e("div",{staticClass:"text-sm text-gray-600 dark:text-gray-300"},[t._v(t._s(t.__("Replace all existing schemas with this preset")))])])])])]):e("div",{staticClass:"no-existing-schemas"},[e("p",{staticClass:"text-gray-600 dark:text-gray-300 mb-4"},[t._v(t._s(t.__("This preset will be added as your first schema.")))]),e("button",{staticClass:"px-6 py-3 bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white border-0 rounded cursor-pointer font-medium transition-all duration-200 w-full",on:{click:function(n){return t.handleAction("add")}}},[t._v(" "+t._s(t.__("Add Preset"))+" ")])])]):e("div",{staticClass:"preset-selection"},[e("p",{staticClass:"text-gray-600 dark:text-gray-300 mb-4"},[t._v(t._s(t.__("Choose a preset to add to your schema:")))]),e("div",{staticClass:"grid grid-cols-1 gap-3"},t._l(t.presets,function(n){return e("div",{key:n.name,staticClass:"border border-gray-200 dark:border-gray-700 rounded-md p-3 cursor-pointer transition-all duration-200 hover:border-blue-500 hover:shadow-sm hover:shadow-blue-500/10 dark:hover:border-blue-400 bg-white dark:bg-gray-800",on:{click:function(i){return t.selectPreset(n)}}},[e("div",{staticClass:"flex justify-between items-start"},[e("div",{staticClass:"flex-1"},[e("h4",{staticClass:"font-semibold text-gray-900 dark:text-white text-sm"},[t._v(t._s(n.name))]),e("p",{staticClass:"text-xs text-gray-600 dark:text-gray-300 mt-1"},[t._v(t._s(n.description))]),e("div",{staticClass:"mt-2"},[e("div",{staticClass:"text-xs text-gray-500 dark:text-gray-400 mb-1"},[t._v(t._s(t.__("Fields:")))]),e("div",{staticClass:"flex flex-wrap gap-1"},[t._l(n.schema.fields.slice(0,3),function(i){return e("span",{key:i.key,staticClass:"bg-blue-50 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 px-1.5 py-0.5 rounded text-[9px] font-medium"},[t._v(" "+t._s(i.key)+" ")])}),n.schema.fields.length>3?e("span",{staticClass:"bg-gray-100 dark:bg-gray-600 text-gray-600 dark:text-gray-300 px-1.5 py-0.5 rounded text-[9px]"},[t._v(" +"+t._s(n.schema.fields.length-3)+" ")]):t._e()],2)])]),e("div",{staticClass:"bg-gray-100 dark:bg-gray-600 text-gray-700 dark:text-gray-200 px-2 py-1 rounded text-xs font-medium ml-2"},[t._v(" "+t._s(n.schema.specialProps.type)+" ")])])])}),0)])]),e("div",{staticClass:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex justify-end flex-shrink-0"},[t.selectedPreset?e("button",{staticClass:"mr-2 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 cursor-pointer transition-all duration-200 hover:bg-gray-50 dark:hover:bg-gray-600 text-sm",on:{click:t.goBack}},[t._v(" "+t._s(t.__("Back"))+" ")]):t._e(),e("button",{staticClass:"px-3 py-2 border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 cursor-pointer transition-all duration-200 hover:bg-gray-50 dark:hover:bg-gray-600 text-sm",on:{click:t.close}},[t._v(" "+t._s(t.__("Cancel"))+" ")])])])]):t._e()},pn=[],vn=Ft(dn,fn,pn,!1,null,null,null,null);const hn=vn.exports;function se(a){const t={};if(a.specialProps&&(a.specialProps.context&&(t["@context"]=a.specialProps.context),a.specialProps.type&&(t["@type"]=a.specialProps.type),a.specialProps.id&&(t["@id"]=a.specialProps.id)),a.fields&&Array.isArray(a.fields))for(const e of a.fields)e.key&&(e.type==="array"&&e.values?t[e.key]=e.values:e.type==="object"&&e.value?t[e.key]=se(e.value):e.type==="object_array"&&e.values?t[e.key]=e.values.map(n=>se(n)):t[e.key]=e.value??null);return t}function We(a,t=2){try{if(Array.isArray(a)){const n=a.map(i=>se(i));return JSON.stringify(n,null,t)}const e=se(a);return JSON.stringify(e,null,t)}catch{return JSON.stringify(a,null,t)}}var gn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mn(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function bn(a){if(a.__esModule)return a;var t=a.default;if(typeof t=="function"){var e=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(a).forEach(function(n){var i=Object.getOwnPropertyDescriptor(a,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return a[n]}})}),e}var Ye={exports:{}};/**! * Sortable 1.10.2 * @author RubaXa * @author owenm * @license MIT - */function ne(a){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ne=function(t){return typeof t}:ne=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ne(a)}function yn(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}function ht(){return ht=Object.assign||function(a){for(var t=1;t=0)&&(e[i]=a[i]);return e}function Cn(a,t){if(a==null)return{};var e=xn(a,t),n,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(a,n)&&(e[n]=a[n])}return e}function Sn(a){return wn(a)||En(a)||On()}function wn(a){if(Array.isArray(a)){for(var t=0,e=new Array(a.length);t"&&(t=t.substring(1)),a)try{if(a.matches)return a.matches(t);if(a.msMatchesSelector)return a.msMatchesSelector(t);if(a.webkitMatchesSelector)return a.webkitMatchesSelector(t)}catch{return!1}return!1}}function Tn(a){return a.host&&a!==document&&a.host.nodeType?a.host:a.parentNode}function bt(a,t,e,n){if(a){e=e||document;do{if(t!=null&&(t[0]===">"?a.parentNode===e&&le(a,t):le(a,t))||n&&a===e)return a;if(a===e)break}while(a=Tn(a))}return null}var Re=/\s+/g;function Y(a,t,e){if(a&&t)if(a.classList)a.classList[e?"add":"remove"](t);else{var n=(" "+a.className+" ").replace(Re," ").replace(" "+t+" "," ");a.className=(n+(e?" "+t:"")).replace(Re," ")}}function C(a,t,e){var n=a&&a.style;if(n){if(e===void 0)return document.defaultView&&document.defaultView.getComputedStyle?e=document.defaultView.getComputedStyle(a,""):a.currentStyle&&(e=a.currentStyle),t===void 0?e:e[t];!(t in n)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),n[t]=e+(typeof e=="string"?"":"px")}}function It(a,t){var e="";if(typeof a=="string")e=a;else do{var n=C(a,"transform");n&&n!=="none"&&(e=n+" "+e)}while(!t&&(a=a.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(e)}function Je(a,t,e){if(a){var n=a.getElementsByTagName(t),i=0,r=n.length;if(e)for(;i=r:o=i<=r,!o)return n;if(n===xt())break;n=Ot(n,!1)}return!1}function ue(a,t,e){for(var n=0,i=0,r=a.children;i2&&arguments[2]!==void 0?arguments[2]:{},i=n.evt,r=Cn(n,["evt"]);Kt.pluginEvent.bind(P)(t,e,Dt({dragEl:x,parentEl:et,ghostEl:N,rootEl:W,nextEl:At,lastDownEl:re,cloneEl:K,cloneHidden:Et,dragStarted:Vt,putSortable:at,activeSortable:P.active,originalEvent:i,oldIndex:$t,oldDraggableIndex:Xt,newIndex:pt,newDraggableIndex:wt,hideGhostForTarget:nn,unhideGhostForTarget:rn,cloneNowHidden:function(){Et=!0},cloneNowShown:function(){Et=!1},dispatchSortableEvent:function(s){lt({sortable:e,name:s,originalEvent:i})}},r))};function lt(a){Bt(Dt({putSortable:at,cloneEl:K,targetEl:x,rootEl:W,oldIndex:$t,oldDraggableIndex:Xt,newIndex:pt,newDraggableIndex:wt},a))}var x,et,N,W,At,re,K,Et,$t,pt,Xt,wt,Zt,at,Mt=!1,ce=!1,de=[],Pt,gt,be,ye,Ve,Ge,Vt,jt,Wt,Yt=!1,Qt=!1,ae,it,xe=[],Pe=!1,fe=[],ve=typeof document<"u",qt=ze,Ue=zt||St?"cssFloat":"float",_n=ve&&!Pn&&!ze&&"draggable"in document.createElement("div"),qe=function(){if(ve){if(St)return!1;var a=document.createElement("x");return a.style.cssText="pointer-events:auto",a.style.pointerEvents==="auto"}}(),tn=function(t,e){var n=C(t),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=ue(t,0,e),o=ue(t,1,e),s=r&&C(r),l=o&&C(o),u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Z(r).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+Z(o).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&s.float&&s.float!=="none"){var d=s.float==="left"?"left":"right";return o&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return r&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||u>=i&&n[Ue]==="none"||o&&n[Ue]==="none"&&u+c>i)?"vertical":"horizontal"},Fn=function(t,e,n){var i=n?t.left:t.top,r=n?t.right:t.bottom,o=n?t.width:t.height,s=n?e.left:e.top,l=n?e.right:e.bottom,u=n?e.width:e.height;return i===s||r===l||i+o/2===s+u/2},Rn=function(t,e){var n;return de.some(function(i){if(!Ne(i)){var r=Z(i),o=i[st].options.emptyInsertThreshold,s=t>=r.left-o&&t<=r.right+o,l=e>=r.top-o&&e<=r.bottom+o;if(o&&s&&l)return n=i}}),n},en=function(t){function e(r,o){return function(s,l,u,c){var d=s.options.group.name&&l.options.group.name&&s.options.group.name===l.options.group.name;if(r==null&&(o||d))return!0;if(r==null||r===!1)return!1;if(o&&r==="clone")return r;if(typeof r=="function")return e(r(s,l,u,c),o)(s,l,u,c);var f=(o?s:l).options.group.name;return r===!0||typeof r=="string"&&r===f||r.join&&r.indexOf(f)>-1}}var n={},i=t.group;(!i||ne(i)!="object")&&(i={name:i}),n.name=i.name,n.checkPull=e(i.pull,!0),n.checkPut=e(i.put),n.revertClone=i.revertClone,t.group=n},nn=function(){!qe&&N&&C(N,"display","none")},rn=function(){!qe&&N&&C(N,"display","")};ve&&document.addEventListener("click",function(a){if(ce)return a.preventDefault(),a.stopPropagation&&a.stopPropagation(),a.stopImmediatePropagation&&a.stopImmediatePropagation(),ce=!1,!1},!0);var Tt=function(t){if(x){t=t.touches?t.touches[0]:t;var e=Rn(t.clientX,t.clientY);if(e){var n={};for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[st]._onDragOver(n)}}},Ln=function(t){x&&x.parentNode[st]._isOutsideThisEl(t.target)};function P(a,t){if(!(a&&a.nodeType&&a.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(a));this.el=a,this.options=t=ht({},t),a[st]=this;var e={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(a.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return tn(a,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(o,s){o.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:P.supportPointer!==!1&&"PointerEvent"in window,emptyInsertThreshold:5};Kt.initializePlugins(this,a,e);for(var n in e)!(n in t)&&(t[n]=e[n]);en(t);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=t.forceFallback?!1:_n,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?R(a,"pointerdown",this._onTapStart):(R(a,"mousedown",this._onTapStart),R(a,"touchstart",this._onTapStart)),this.nativeDraggable&&(R(a,"dragover",this),R(a,"dragenter",this)),de.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),ht(this,Nn())}P.prototype={constructor:P,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(jt=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,x):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,i=this.options,r=i.preventOnFilter,o=t.type,s=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,l=(s||t).target,u=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,c=i.filter;if(Xn(n),!x&&!(/mousedown|pointerdown/.test(o)&&t.button!==0||i.disabled)&&!u.isContentEditable&&(l=bt(l,i.draggable,n,!1),!(l&&l.animated)&&re!==l)){if($t=J(l),Xt=J(l,i.draggable),typeof c=="function"){if(c.call(this,t,l,this)){lt({sortable:e,rootEl:u,name:"filter",targetEl:l,toEl:n,fromEl:n}),ut("filter",e,{evt:t}),r&&t.cancelable&&t.preventDefault();return}}else if(c&&(c=c.split(",").some(function(d){if(d=bt(u,d.trim(),n,!1),d)return lt({sortable:e,rootEl:d,name:"filter",targetEl:l,fromEl:n,toEl:n}),ut("filter",e,{evt:t}),!0}),c)){r&&t.cancelable&&t.preventDefault();return}i.handle&&!bt(u,i.handle,n,!1)||this._prepareDragStart(t,s,l)}}},_prepareDragStart:function(t,e,n){var i=this,r=i.el,o=i.options,s=r.ownerDocument,l;if(n&&!x&&n.parentNode===r){var u=Z(n);if(W=r,x=n,et=x.parentNode,At=x.nextSibling,re=n,Zt=o.group,P.dragged=x,Pt={target:x,clientX:(e||t).clientX,clientY:(e||t).clientY},Ve=Pt.clientX-u.left,Ge=Pt.clientY-u.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,x.style["will-change"]="all",l=function(){if(ut("delayEnded",i,{evt:t}),P.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!Fe&&i.nativeDraggable&&(x.draggable=!0),i._triggerDragStart(t,e),lt({sortable:i,name:"choose",originalEvent:t}),Y(x,o.chosenClass,!0)},o.ignore.split(",").forEach(function(c){Je(x,c.trim(),Se)}),R(s,"dragover",Tt),R(s,"mousemove",Tt),R(s,"touchmove",Tt),R(s,"mouseup",i._onDrop),R(s,"touchend",i._onDrop),R(s,"touchcancel",i._onDrop),Fe&&this.nativeDraggable&&(this.options.touchStartThreshold=4,x.draggable=!0),ut("delayStart",this,{evt:t}),o.delay&&(!o.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(zt||St))){if(P.eventCanceled){this._onDrop();return}R(s,"mouseup",i._disableDelayedDrag),R(s,"touchend",i._disableDelayedDrag),R(s,"touchcancel",i._disableDelayedDrag),R(s,"mousemove",i._delayedDragTouchMoveHandler),R(s,"touchmove",i._delayedDragTouchMoveHandler),o.supportPointer&&R(s,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(l,o.delay)}else l()}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){x&&Se(x),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;_(t,"mouseup",this._disableDelayedDrag),_(t,"touchend",this._disableDelayedDrag),_(t,"touchcancel",this._disableDelayedDrag),_(t,"mousemove",this._delayedDragTouchMoveHandler),_(t,"touchmove",this._delayedDragTouchMoveHandler),_(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?R(document,"pointermove",this._onTouchMove):e?R(document,"touchmove",this._onTouchMove):R(document,"mousemove",this._onTouchMove):(R(x,"dragend",this),R(W,"dragstart",this._onDragStart));try{document.selection?oe(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Mt=!1,W&&x){ut("dragStarted",this,{evt:e}),this.nativeDraggable&&R(document,"dragover",Ln);var n=this.options;!t&&Y(x,n.dragClass,!1),Y(x,n.ghostClass,!0),P.active=this,t&&this._appendGhost(),lt({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(gt){this._lastX=gt.clientX,this._lastY=gt.clientY,nn();for(var t=document.elementFromPoint(gt.clientX,gt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(gt.clientX,gt.clientY),t!==e);)e=t;if(x.parentNode[st]._isOutsideThisEl(t),e)do{if(e[st]){var n=void 0;if(n=e[st]._onDragOver({clientX:gt.clientX,clientY:gt.clientY,target:t,rootEl:e}),n&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);rn()}},_onTouchMove:function(t){if(Pt){var e=this.options,n=e.fallbackTolerance,i=e.fallbackOffset,r=t.touches?t.touches[0]:t,o=N&&It(N,!0),s=N&&o&&o.a,l=N&&o&&o.d,u=qt&&it&&ke(it),c=(r.clientX-Pt.clientX+i.x)/(s||1)+(u?u[0]-xe[0]:0)/(s||1),d=(r.clientY-Pt.clientY+i.y)/(l||1)+(u?u[1]-xe[1]:0)/(l||1);if(!P.active&&!Mt){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))=0&&(lt({rootEl:et,name:"add",toEl:et,fromEl:W,originalEvent:t}),lt({sortable:this,name:"remove",toEl:et,originalEvent:t}),lt({rootEl:et,name:"sort",toEl:et,fromEl:W,originalEvent:t}),lt({sortable:this,name:"sort",toEl:et,originalEvent:t})),at&&at.save()):pt!==$t&&pt>=0&&(lt({sortable:this,name:"update",toEl:et,originalEvent:t}),lt({sortable:this,name:"sort",toEl:et,originalEvent:t})),P.active&&((pt==null||pt===-1)&&(pt=$t,wt=Xt),lt({sortable:this,name:"end",toEl:et,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){ut("nulling",this),W=x=et=N=At=K=re=Et=Pt=gt=Vt=pt=wt=$t=Xt=jt=Wt=at=Zt=P.dragged=P.ghost=P.clone=P.active=null,fe.forEach(function(t){t.checked=!0}),fe.length=be=ye=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":x&&(this._onDragOver(t),kn(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,n=this.el.children,i=0,r=n.length,o=this.options;in.right+i||a.clientX<=n.right&&a.clientY>n.bottom&&a.clientX>=n.left:a.clientX>n.right&&a.clientY>n.top||a.clientX<=n.right&&a.clientY>n.bottom+i}function Gn(a,t,e,n,i,r,o,s){var l=n?a.clientY:a.clientX,u=n?e.height:e.width,c=n?e.top:e.left,d=n?e.bottom:e.right,f=!1;if(!o){if(s&&aec+u*r/2:ld-ae)return-Wt}else if(l>c+u*(1-i)/2&&ld-u*r/2)?l>c+u/2?1:-1:0}function Un(a){return J(x)1&&(I.forEach(function(s){r.addAnimationState({target:s,rect:dt?Z(s):o}),ge(s),s.fromRect=o,n.removeAnimationState(s)}),dt=!1,Jn(!this.options.removeCloneOnHide,i))},dragOverCompleted:function(e){var n=e.sortable,i=e.isOwner,r=e.insertion,o=e.activeSortable,s=e.parentEl,l=e.putSortable,u=this.options;if(r){if(i&&o._hideClone(),Lt=!1,u.animation&&I.length>1&&(dt||!i&&!o.options.sort&&!l)){var c=Z(H,!1,!0,!0);I.forEach(function(f){f!==H&&(Be(f,c),s.appendChild(f))}),dt=!0}if(!i)if(dt||ee(),I.length>1){var d=te;o._showClone(n),o.options.animation&&!te&&d&&ft.forEach(function(f){o.addAnimationState({target:f,rect:kt}),f.fromRect=kt,f.thisAnimationDuration=null})}else o._showClone(n)}},dragOverAnimationCapture:function(e){var n=e.dragRect,i=e.isOwner,r=e.activeSortable;if(I.forEach(function(s){s.thisAnimationDuration=null}),r.options.animation&&!i&&r.multiDrag.isMultiDrag){kt=ht({},n);var o=It(H,!0);kt.top-=o.f,kt.left-=o.e}},dragOverAnimationComplete:function(){dt&&(dt=!1,ee())},drop:function(e){var n=e.originalEvent,i=e.rootEl,r=e.parentEl,o=e.sortable,s=e.dispatchSortableEvent,l=e.oldIndex,u=e.putSortable,c=u||this.sortable;if(n){var d=this.options,f=r.children;if(!Nt)if(d.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),Y(H,d.selectedClass,!~I.indexOf(H)),~I.indexOf(H))I.splice(I.indexOf(H),1),Rt=null,Bt({sortable:o,rootEl:i,name:"deselect",targetEl:H,originalEvt:n});else{if(I.push(H),Bt({sortable:o,rootEl:i,name:"select",targetEl:H,originalEvt:n}),n.shiftKey&&Rt&&o.el.contains(Rt)){var b=J(Rt),v=J(H);if(~b&&~v&&b!==v){var h,y;for(v>b?(y=b,h=v):(y=v,h=b+1);y1){var O=Z(H),D=J(H,":not(."+this.options.selectedClass+")");if(!Lt&&d.animation&&(H.thisAnimationDuration=null),c.captureAnimationState(),!Lt&&(d.animation&&(H.fromRect=O,I.forEach(function(w){if(w.thisAnimationDuration=null,w!==H){var F=dt?Z(w):O;w.fromRect=F,c.addAnimationState({target:w,rect:F})}})),ee(),I.forEach(function(w){f[D]?r.insertBefore(w,f[D]):r.appendChild(w),D++}),l===J(H))){var E=!1;I.forEach(function(w){if(w.sortableIndex!==J(w)){E=!0;return}}),E&&s("update")}I.forEach(function(w){ge(w)}),c.animateAll()}mt=c}(i===r||u&&u.lastPutMode!=="clone")&&ft.forEach(function(w){w.parentNode&&w.parentNode.removeChild(w)})}},nullingGlobal:function(){this.isMultiDrag=Nt=!1,ft.length=0},destroyGlobal:function(){this._deselectMultiDrag(),_(document,"pointerup",this._deselectMultiDrag),_(document,"mouseup",this._deselectMultiDrag),_(document,"touchend",this._deselectMultiDrag),_(document,"keydown",this._checkKeyDown),_(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(e){if(!(typeof Nt<"u"&&Nt)&&mt===this.sortable&&!(e&&bt(e.target,this.options.draggable,this.sortable.el,!1))&&!(e&&e.button!==0))for(;I.length;){var n=I[0];Y(n,this.options.selectedClass,!1),I.shift(),Bt({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:n,originalEvt:e})}},_checkKeyDown:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},ht(a,{pluginName:"multiDrag",utils:{select:function(e){var n=e.parentNode[st];!n||!n.options.multiDrag||~I.indexOf(e)||(mt&&mt!==n&&(mt.multiDrag._deselectMultiDrag(),mt=n),Y(e,n.options.selectedClass,!0),I.push(e))},deselect:function(e){var n=e.parentNode[st],i=I.indexOf(e);!n||!n.options.multiDrag||!~i||(Y(e,n.options.selectedClass,!1),I.splice(i,1))}},eventProperties:function(){var e=this,n=[],i=[];return I.forEach(function(r){n.push({multiDragElement:r,index:r.sortableIndex});var o;dt&&r!==H?o=-1:dt?o=J(r,":not(."+e.options.selectedClass+")"):o=J(r),i.push({multiDragElement:r,index:o})}),{items:Sn(I),clones:[].concat(ft),oldIndicies:n,newIndicies:i}},optionListeners:{multiDragKey:function(e){return e=e.toLowerCase(),e==="ctrl"?e="Control":e.length>1&&(e=e.charAt(0).toUpperCase()+e.substr(1)),e}}})}function Jn(a,t){I.forEach(function(e,n){var i=t.children[e.sortableIndex+(a?Number(n):0)];i?t.insertBefore(e,i):t.appendChild(e)})}function Xe(a,t){ft.forEach(function(e,n){var i=t.children[e.sortableIndex+(a?Number(n):0)];i?t.insertBefore(e,i):t.appendChild(e)})}function ee(){I.forEach(function(a){a!==H&&a.parentNode&&a.parentNode.removeChild(a)})}P.mount(new Wn);P.mount(_e,$e);const Zn=Object.freeze(Object.defineProperty({__proto__:null,MultiDrag:Kn,Sortable:P,Swap:Yn,default:P},Symbol.toStringTag,{value:"Module"})),Qn=bn(Zn);(function(a,t){(function(n,i){a.exports=i(Qn)})(typeof self<"u"?self:gn,function(e){return function(n){var i={};function r(o){if(i[o])return i[o].exports;var s=i[o]={i:o,l:!1,exports:{}};return n[o].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=i,r.d=function(o,s,l){r.o(o,s)||Object.defineProperty(o,s,{enumerable:!0,get:l})},r.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},r.t=function(o,s){if(s&1&&(o=r(o)),s&8||s&4&&typeof o=="object"&&o&&o.__esModule)return o;var l=Object.create(null);if(r.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:o}),s&2&&typeof o!="string")for(var u in o)r.d(l,u,(function(c){return o[c]}).bind(null,u));return l},r.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return r.d(s,"a",s),s},r.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},r.p="",r(r.s="fb15")}({"01f9":function(n,i,r){var o=r("2d00"),s=r("5ca1"),l=r("2aba"),u=r("32e9"),c=r("84f2"),d=r("41a0"),f=r("7f20"),b=r("38fd"),v=r("2b4c")("iterator"),h=!([].keys&&"next"in[].keys()),y="@@iterator",O="keys",D="values",E=function(){return this};n.exports=function(w,F,k,B,A,j,T){d(k,F,B);var L=function(g){if(!h&&g in U)return U[g];switch(g){case O:return function(){return new k(this,g)};case D:return function(){return new k(this,g)}}return function(){return new k(this,g)}},z=F+" Iterator",tt=A==D,Q=!1,U=w.prototype,V=U[v]||U[y]||A&&U[A],X=V||L(A),ct=A?tt?L("entries"):X:void 0,ot=F=="Array"&&U.entries||V,rt,m,p;if(ot&&(p=b(ot.call(new w)),p!==Object.prototype&&p.next&&(f(p,z,!0),!o&&typeof p[v]!="function"&&u(p,v,E))),tt&&V&&V.name!==D&&(Q=!0,X=function(){return V.call(this)}),(!o||T)&&(h||Q||!U[v])&&u(U,v,X),c[F]=X,c[z]=E,A)if(rt={values:tt?X:L(D),keys:j?X:L(O),entries:ct},T)for(m in rt)m in U||l(U,m,rt[m]);else s(s.P+s.F*(h||Q),F,rt);return rt}},"02f4":function(n,i,r){var o=r("4588"),s=r("be13");n.exports=function(l){return function(u,c){var d=String(s(u)),f=o(c),b=d.length,v,h;return f<0||f>=b?l?"":void 0:(v=d.charCodeAt(f),v<55296||v>56319||f+1===b||(h=d.charCodeAt(f+1))<56320||h>57343?l?d.charAt(f):v:l?d.slice(f,f+2):(v-55296<<10)+(h-56320)+65536)}}},"0390":function(n,i,r){var o=r("02f4")(!0);n.exports=function(s,l,u){return l+(u?o(s,l).length:1)}},"0bfb":function(n,i,r){var o=r("cb7c");n.exports=function(){var s=o(this),l="";return s.global&&(l+="g"),s.ignoreCase&&(l+="i"),s.multiline&&(l+="m"),s.unicode&&(l+="u"),s.sticky&&(l+="y"),l}},"0d58":function(n,i,r){var o=r("ce10"),s=r("e11e");n.exports=Object.keys||function(u){return o(u,s)}},1495:function(n,i,r){var o=r("86cc"),s=r("cb7c"),l=r("0d58");n.exports=r("9e1e")?Object.defineProperties:function(c,d){s(c);for(var f=l(d),b=f.length,v=0,h;b>v;)o.f(c,h=f[v++],d[h]);return c}},"214f":function(n,i,r){r("b0c5");var o=r("2aba"),s=r("32e9"),l=r("79e5"),u=r("be13"),c=r("2b4c"),d=r("520a"),f=c("species"),b=!l(function(){var h=/./;return h.exec=function(){var y=[];return y.groups={a:"7"},y},"".replace(h,"$")!=="7"}),v=function(){var h=/(?:)/,y=h.exec;h.exec=function(){return y.apply(this,arguments)};var O="ab".split(h);return O.length===2&&O[0]==="a"&&O[1]==="b"}();n.exports=function(h,y,O){var D=c(h),E=!l(function(){var j={};return j[D]=function(){return 7},""[h](j)!=7}),w=E?!l(function(){var j=!1,T=/a/;return T.exec=function(){return j=!0,null},h==="split"&&(T.constructor={},T.constructor[f]=function(){return T}),T[D](""),!j}):void 0;if(!E||!w||h==="replace"&&!b||h==="split"&&!v){var F=/./[D],k=O(u,D,""[h],function(T,L,z,tt,Q){return L.exec===d?E&&!Q?{done:!0,value:F.call(L,z,tt)}:{done:!0,value:T.call(z,L,tt)}:{done:!1}}),B=k[0],A=k[1];o(String.prototype,h,B),s(RegExp.prototype,D,y==2?function(j,T){return A.call(j,this,T)}:function(j){return A.call(j,this)})}}},"230e":function(n,i,r){var o=r("d3f4"),s=r("7726").document,l=o(s)&&o(s.createElement);n.exports=function(u){return l?s.createElement(u):{}}},"23c6":function(n,i,r){var o=r("2d95"),s=r("2b4c")("toStringTag"),l=o(function(){return arguments}())=="Arguments",u=function(c,d){try{return c[d]}catch{}};n.exports=function(c){var d,f,b;return c===void 0?"Undefined":c===null?"Null":typeof(f=u(d=Object(c),s))=="string"?f:l?o(d):(b=o(d))=="Object"&&typeof d.callee=="function"?"Arguments":b}},2621:function(n,i){i.f=Object.getOwnPropertySymbols},"2aba":function(n,i,r){var o=r("7726"),s=r("32e9"),l=r("69a8"),u=r("ca5a")("src"),c=r("fa5b"),d="toString",f=(""+c).split(d);r("8378").inspectSource=function(b){return c.call(b)},(n.exports=function(b,v,h,y){var O=typeof h=="function";O&&(l(h,"name")||s(h,"name",v)),b[v]!==h&&(O&&(l(h,u)||s(h,u,b[v]?""+b[v]:f.join(String(v)))),b===o?b[v]=h:y?b[v]?b[v]=h:s(b,v,h):(delete b[v],s(b,v,h)))})(Function.prototype,d,function(){return typeof this=="function"&&this[u]||c.call(this)})},"2aeb":function(n,i,r){var o=r("cb7c"),s=r("1495"),l=r("e11e"),u=r("613b")("IE_PROTO"),c=function(){},d="prototype",f=function(){var b=r("230e")("iframe"),v=l.length,h="<",y=">",O;for(b.style.display="none",r("fab2").appendChild(b),b.src="javascript:",O=b.contentWindow.document,O.open(),O.write(h+"script"+y+"document.F=Object"+h+"/script"+y),O.close(),f=O.F;v--;)delete f[d][l[v]];return f()};n.exports=Object.create||function(v,h){var y;return v!==null?(c[d]=o(v),y=new c,c[d]=null,y[u]=v):y=f(),h===void 0?y:s(y,h)}},"2b4c":function(n,i,r){var o=r("5537")("wks"),s=r("ca5a"),l=r("7726").Symbol,u=typeof l=="function",c=n.exports=function(d){return o[d]||(o[d]=u&&l[d]||(u?l:s)("Symbol."+d))};c.store=o},"2d00":function(n,i){n.exports=!1},"2d95":function(n,i){var r={}.toString;n.exports=function(o){return r.call(o).slice(8,-1)}},"2fdb":function(n,i,r){var o=r("5ca1"),s=r("d2c8"),l="includes";o(o.P+o.F*r("5147")(l),"String",{includes:function(c){return!!~s(this,c,l).indexOf(c,arguments.length>1?arguments[1]:void 0)}})},"32e9":function(n,i,r){var o=r("86cc"),s=r("4630");n.exports=r("9e1e")?function(l,u,c){return o.f(l,u,s(1,c))}:function(l,u,c){return l[u]=c,l}},"38fd":function(n,i,r){var o=r("69a8"),s=r("4bf8"),l=r("613b")("IE_PROTO"),u=Object.prototype;n.exports=Object.getPrototypeOf||function(c){return c=s(c),o(c,l)?c[l]:typeof c.constructor=="function"&&c instanceof c.constructor?c.constructor.prototype:c instanceof Object?u:null}},"41a0":function(n,i,r){var o=r("2aeb"),s=r("4630"),l=r("7f20"),u={};r("32e9")(u,r("2b4c")("iterator"),function(){return this}),n.exports=function(c,d,f){c.prototype=o(u,{next:s(1,f)}),l(c,d+" Iterator")}},"456d":function(n,i,r){var o=r("4bf8"),s=r("0d58");r("5eda")("keys",function(){return function(u){return s(o(u))}})},4588:function(n,i){var r=Math.ceil,o=Math.floor;n.exports=function(s){return isNaN(s=+s)?0:(s>0?o:r)(s)}},4630:function(n,i){n.exports=function(r,o){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:o}}},"4bf8":function(n,i,r){var o=r("be13");n.exports=function(s){return Object(o(s))}},5147:function(n,i,r){var o=r("2b4c")("match");n.exports=function(s){var l=/./;try{"/./"[s](l)}catch{try{return l[o]=!1,!"/./"[s](l)}catch{}}return!0}},"520a":function(n,i,r){var o=r("0bfb"),s=RegExp.prototype.exec,l=String.prototype.replace,u=s,c="lastIndex",d=function(){var v=/a/,h=/b*/g;return s.call(v,"a"),s.call(h,"a"),v[c]!==0||h[c]!==0}(),f=/()??/.exec("")[1]!==void 0,b=d||f;b&&(u=function(h){var y=this,O,D,E,w;return f&&(D=new RegExp("^"+y.source+"$(?!\\s)",o.call(y))),d&&(O=y[c]),E=s.call(y,h),d&&E&&(y[c]=y.global?E.index+E[0].length:O),f&&E&&E.length>1&&l.call(E[0],D,function(){for(w=1;w1?arguments[1]:void 0)}}),r("9c6c")("includes")},6821:function(n,i,r){var o=r("626a"),s=r("be13");n.exports=function(l){return o(s(l))}},"69a8":function(n,i){var r={}.hasOwnProperty;n.exports=function(o,s){return r.call(o,s)}},"6a99":function(n,i,r){var o=r("d3f4");n.exports=function(s,l){if(!o(s))return s;var u,c;if(l&&typeof(u=s.toString)=="function"&&!o(c=u.call(s))||typeof(u=s.valueOf)=="function"&&!o(c=u.call(s))||!l&&typeof(u=s.toString)=="function"&&!o(c=u.call(s)))return c;throw TypeError("Can't convert object to primitive value")}},7333:function(n,i,r){var o=r("0d58"),s=r("2621"),l=r("52a7"),u=r("4bf8"),c=r("626a"),d=Object.assign;n.exports=!d||r("79e5")(function(){var f={},b={},v=Symbol(),h="abcdefghijklmnopqrst";return f[v]=7,h.split("").forEach(function(y){b[y]=y}),d({},f)[v]!=7||Object.keys(d({},b)).join("")!=h})?function(b,v){for(var h=u(b),y=arguments.length,O=1,D=s.f,E=l.f;y>O;)for(var w=c(arguments[O++]),F=D?o(w).concat(D(w)):o(w),k=F.length,B=0,A;k>B;)E.call(w,A=F[B++])&&(h[A]=w[A]);return h}:d},7726:function(n,i){var r=n.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=r)},"77f1":function(n,i,r){var o=r("4588"),s=Math.max,l=Math.min;n.exports=function(u,c){return u=o(u),u<0?s(u+c,0):l(u,c)}},"79e5":function(n,i){n.exports=function(r){try{return!!r()}catch{return!0}}},"7f20":function(n,i,r){var o=r("86cc").f,s=r("69a8"),l=r("2b4c")("toStringTag");n.exports=function(u,c,d){u&&!s(u=d?u:u.prototype,l)&&o(u,l,{configurable:!0,value:c})}},8378:function(n,i){var r=n.exports={version:"2.6.5"};typeof __e=="number"&&(__e=r)},"84f2":function(n,i){n.exports={}},"86cc":function(n,i,r){var o=r("cb7c"),s=r("c69a"),l=r("6a99"),u=Object.defineProperty;i.f=r("9e1e")?Object.defineProperty:function(d,f,b){if(o(d),f=l(f,!0),o(b),s)try{return u(d,f,b)}catch{}if("get"in b||"set"in b)throw TypeError("Accessors not supported!");return"value"in b&&(d[f]=b.value),d}},"9b43":function(n,i,r){var o=r("d8e8");n.exports=function(s,l,u){if(o(s),l===void 0)return s;switch(u){case 1:return function(c){return s.call(l,c)};case 2:return function(c,d){return s.call(l,c,d)};case 3:return function(c,d,f){return s.call(l,c,d,f)}}return function(){return s.apply(l,arguments)}}},"9c6c":function(n,i,r){var o=r("2b4c")("unscopables"),s=Array.prototype;s[o]==null&&r("32e9")(s,o,{}),n.exports=function(l){s[o][l]=!0}},"9def":function(n,i,r){var o=r("4588"),s=Math.min;n.exports=function(l){return l>0?s(o(l),9007199254740991):0}},"9e1e":function(n,i,r){n.exports=!r("79e5")(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},a352:function(n,i){n.exports=e},a481:function(n,i,r){var o=r("cb7c"),s=r("4bf8"),l=r("9def"),u=r("4588"),c=r("0390"),d=r("5f1b"),f=Math.max,b=Math.min,v=Math.floor,h=/\$([$&`']|\d\d?|<[^>]*>)/g,y=/\$([$&`']|\d\d?)/g,O=function(D){return D===void 0?D:String(D)};r("214f")("replace",2,function(D,E,w,F){return[function(A,j){var T=D(this),L=A==null?void 0:A[E];return L!==void 0?L.call(A,T,j):w.call(String(T),A,j)},function(B,A){var j=F(w,B,this,A);if(j.done)return j.value;var T=o(B),L=String(this),z=typeof A=="function";z||(A=String(A));var tt=T.global;if(tt){var Q=T.unicode;T.lastIndex=0}for(var U=[];;){var V=d(T,L);if(V===null||(U.push(V),!tt))break;var X=String(V[0]);X===""&&(T.lastIndex=c(L,l(T.lastIndex),Q))}for(var ct="",ot=0,rt=0;rt=ot&&(ct+=L.slice(ot,p)+G,ot=p+m.length)}return ct+L.slice(ot)}];function k(B,A,j,T,L,z){var tt=j+B.length,Q=T.length,U=y;return L!==void 0&&(L=s(L),U=h),w.call(z,U,function(V,X){var ct;switch(X.charAt(0)){case"$":return"$";case"&":return B;case"`":return A.slice(0,j);case"'":return A.slice(tt);case"<":ct=L[X.slice(1,-1)];break;default:var ot=+X;if(ot===0)return V;if(ot>Q){var rt=v(ot/10);return rt===0?V:rt<=Q?T[rt-1]===void 0?X.charAt(1):T[rt-1]+X.charAt(1):V}ct=T[ot-1]}return ct===void 0?"":ct})}})},aae3:function(n,i,r){var o=r("d3f4"),s=r("2d95"),l=r("2b4c")("match");n.exports=function(u){var c;return o(u)&&((c=u[l])!==void 0?!!c:s(u)=="RegExp")}},ac6a:function(n,i,r){for(var o=r("cadf"),s=r("0d58"),l=r("2aba"),u=r("7726"),c=r("32e9"),d=r("84f2"),f=r("2b4c"),b=f("iterator"),v=f("toStringTag"),h=d.Array,y={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},O=s(y),D=0;Dh;)if(y=b[h++],y!=y)return!0}else for(;v>h;h++)if((u||h in b)&&b[h]===d)return u||h||0;return!u&&-1}}},c649:function(n,i,r){(function(o){r.d(i,"c",function(){return b}),r.d(i,"a",function(){return d}),r.d(i,"b",function(){return l}),r.d(i,"d",function(){return f}),r("a481");function s(){return typeof window<"u"?window.console:o.console}var l=s();function u(v){var h=Object.create(null);return function(O){var D=h[O];return D||(h[O]=v(O))}}var c=/-(\w)/g,d=u(function(v){return v.replace(c,function(h,y){return y?y.toUpperCase():""})});function f(v){v.parentElement!==null&&v.parentElement.removeChild(v)}function b(v,h,y){var O=y===0?v.children[0]:v.children[y-1].nextSibling;v.insertBefore(h,O)}}).call(this,r("c8ba"))},c69a:function(n,i,r){n.exports=!r("9e1e")&&!r("79e5")(function(){return Object.defineProperty(r("230e")("div"),"a",{get:function(){return 7}}).a!=7})},c8ba:function(n,i){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch{typeof window=="object"&&(r=window)}n.exports=r},ca5a:function(n,i){var r=0,o=Math.random();n.exports=function(s){return"Symbol(".concat(s===void 0?"":s,")_",(++r+o).toString(36))}},cadf:function(n,i,r){var o=r("9c6c"),s=r("d53b"),l=r("84f2"),u=r("6821");n.exports=r("01f9")(Array,"Array",function(c,d){this._t=u(c),this._i=0,this._k=d},function(){var c=this._t,d=this._k,f=this._i++;return!c||f>=c.length?(this._t=void 0,s(1)):d=="keys"?s(0,f):d=="values"?s(0,c[f]):s(0,[f,c[f]])},"values"),l.Arguments=l.Array,o("keys"),o("values"),o("entries")},cb7c:function(n,i,r){var o=r("d3f4");n.exports=function(s){if(!o(s))throw TypeError(s+" is not an object!");return s}},ce10:function(n,i,r){var o=r("69a8"),s=r("6821"),l=r("c366")(!1),u=r("613b")("IE_PROTO");n.exports=function(c,d){var f=s(c),b=0,v=[],h;for(h in f)h!=u&&o(f,h)&&v.push(h);for(;d.length>b;)o(f,h=d[b++])&&(~l(v,h)||v.push(h));return v}},d2c8:function(n,i,r){var o=r("aae3"),s=r("be13");n.exports=function(l,u,c){if(o(u))throw TypeError("String#"+c+" doesn't accept regex!");return String(s(l))}},d3f4:function(n,i){n.exports=function(r){return typeof r=="object"?r!==null:typeof r=="function"}},d53b:function(n,i){n.exports=function(r,o){return{value:o,done:!!r}}},d8e8:function(n,i){n.exports=function(r){if(typeof r!="function")throw TypeError(r+" is not a function!");return r}},e11e:function(n,i){n.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},f559:function(n,i,r){var o=r("5ca1"),s=r("9def"),l=r("d2c8"),u="startsWith",c=""[u];o(o.P+o.F*r("5147")(u),"String",{startsWith:function(f){var b=l(this,f,u),v=s(Math.min(arguments.length>1?arguments[1]:void 0,b.length)),h=String(f);return c?c.call(b,h,v):b.slice(v,v+h.length)===h}})},f6fd:function(n,i){(function(r){var o="currentScript",s=r.getElementsByTagName("script");o in r||Object.defineProperty(r,o,{get:function(){try{throw new Error}catch(c){var l,u=(/.*at [^\(]*\((.*):.+:.+\)$/ig.exec(c.stack)||[!1])[1];for(l in s)if(s[l].src==u||s[l].readyState=="interactive")return s[l];return null}}})})(document)},f751:function(n,i,r){var o=r("5ca1");o(o.S+o.F,"Object",{assign:r("7333")})},fa5b:function(n,i,r){n.exports=r("5537")("native-function-to-string",Function.toString)},fab2:function(n,i,r){var o=r("7726").document;n.exports=o&&o.documentElement},fb15:function(n,i,r){if(r.r(i),typeof window<"u"){r("f6fd");var o;(o=window.document.currentScript)&&(o=o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(r.p=o[1])}r("f751"),r("f559"),r("ac6a"),r("cadf"),r("456d");function s(m){if(Array.isArray(m))return m}function l(m,p){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(m)))){var g=[],S=!0,M=!1,$=void 0;try{for(var G=m[Symbol.iterator](),q;!(S=(q=G.next()).done)&&(g.push(q.value),!(p&&g.length===p));S=!0);}catch(yt){M=!0,$=yt}finally{try{!S&&G.return!=null&&G.return()}finally{if(M)throw $}}return g}}function u(m,p){(p==null||p>m.length)&&(p=m.length);for(var g=0,S=new Array(p);g=0)&&(e[i]=a[i]);return e}function Cn(a,t){if(a==null)return{};var e=xn(a,t),n,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(a,n)&&(e[n]=a[n])}return e}function Sn(a){return wn(a)||En(a)||On()}function wn(a){if(Array.isArray(a)){for(var t=0,e=new Array(a.length);t"&&(t=t.substring(1)),a)try{if(a.matches)return a.matches(t);if(a.msMatchesSelector)return a.msMatchesSelector(t);if(a.webkitMatchesSelector)return a.webkitMatchesSelector(t)}catch{return!1}return!1}}function Tn(a){return a.host&&a!==document&&a.host.nodeType?a.host:a.parentNode}function bt(a,t,e,n){if(a){e=e||document;do{if(t!=null&&(t[0]===">"?a.parentNode===e&&le(a,t):le(a,t))||n&&a===e)return a;if(a===e)break}while(a=Tn(a))}return null}var _e=/\s+/g;function Y(a,t,e){if(a&&t)if(a.classList)a.classList[e?"add":"remove"](t);else{var n=(" "+a.className+" ").replace(_e," ").replace(" "+t+" "," ");a.className=(n+(e?" "+t:"")).replace(_e," ")}}function C(a,t,e){var n=a&&a.style;if(n){if(e===void 0)return document.defaultView&&document.defaultView.getComputedStyle?e=document.defaultView.getComputedStyle(a,""):a.currentStyle&&(e=a.currentStyle),t===void 0?e:e[t];!(t in n)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),n[t]=e+(typeof e=="string"?"":"px")}}function It(a,t){var e="";if(typeof a=="string")e=a;else do{var n=C(a,"transform");n&&n!=="none"&&(e=n+" "+e)}while(!t&&(a=a.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(e)}function Je(a,t,e){if(a){var n=a.getElementsByTagName(t),i=0,r=n.length;if(e)for(;i=r:o=i<=r,!o)return n;if(n===xt())break;n=Ot(n,!1)}return!1}function ue(a,t,e){for(var n=0,i=0,r=a.children;i2&&arguments[2]!==void 0?arguments[2]:{},i=n.evt,r=Cn(n,["evt"]);Kt.pluginEvent.bind(P)(t,e,Dt({dragEl:x,parentEl:et,ghostEl:N,rootEl:W,nextEl:At,lastDownEl:re,cloneEl:K,cloneHidden:Et,dragStarted:Vt,putSortable:at,activeSortable:P.active,originalEvent:i,oldIndex:$t,oldDraggableIndex:Xt,newIndex:pt,newDraggableIndex:wt,hideGhostForTarget:nn,unhideGhostForTarget:rn,cloneNowHidden:function(){Et=!0},cloneNowShown:function(){Et=!1},dispatchSortableEvent:function(s){lt({sortable:e,name:s,originalEvent:i})}},r))};function lt(a){Bt(Dt({putSortable:at,cloneEl:K,targetEl:x,rootEl:W,oldIndex:$t,oldDraggableIndex:Xt,newIndex:pt,newDraggableIndex:wt},a))}var x,et,N,W,At,re,K,Et,$t,pt,Xt,wt,Zt,at,Mt=!1,ce=!1,de=[],Pt,gt,be,ye,Be,Ve,Vt,jt,Wt,Yt=!1,Qt=!1,ae,it,xe=[],Pe=!1,fe=[],ve=typeof document<"u",qt=ze,Ge=zt||St?"cssFloat":"float",Fn=ve&&!Pn&&!ze&&"draggable"in document.createElement("div"),qe=function(){if(ve){if(St)return!1;var a=document.createElement("x");return a.style.cssText="pointer-events:auto",a.style.pointerEvents==="auto"}}(),tn=function(t,e){var n=C(t),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=ue(t,0,e),o=ue(t,1,e),s=r&&C(r),l=o&&C(o),u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Z(r).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+Z(o).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&s.float&&s.float!=="none"){var d=s.float==="left"?"left":"right";return o&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return r&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||u>=i&&n[Ge]==="none"||o&&n[Ge]==="none"&&u+c>i)?"vertical":"horizontal"},_n=function(t,e,n){var i=n?t.left:t.top,r=n?t.right:t.bottom,o=n?t.width:t.height,s=n?e.left:e.top,l=n?e.right:e.bottom,u=n?e.width:e.height;return i===s||r===l||i+o/2===s+u/2},Rn=function(t,e){var n;return de.some(function(i){if(!je(i)){var r=Z(i),o=i[st].options.emptyInsertThreshold,s=t>=r.left-o&&t<=r.right+o,l=e>=r.top-o&&e<=r.bottom+o;if(o&&s&&l)return n=i}}),n},en=function(t){function e(r,o){return function(s,l,u,c){var d=s.options.group.name&&l.options.group.name&&s.options.group.name===l.options.group.name;if(r==null&&(o||d))return!0;if(r==null||r===!1)return!1;if(o&&r==="clone")return r;if(typeof r=="function")return e(r(s,l,u,c),o)(s,l,u,c);var f=(o?s:l).options.group.name;return r===!0||typeof r=="string"&&r===f||r.join&&r.indexOf(f)>-1}}var n={},i=t.group;(!i||ne(i)!="object")&&(i={name:i}),n.name=i.name,n.checkPull=e(i.pull,!0),n.checkPut=e(i.put),n.revertClone=i.revertClone,t.group=n},nn=function(){!qe&&N&&C(N,"display","none")},rn=function(){!qe&&N&&C(N,"display","")};ve&&document.addEventListener("click",function(a){if(ce)return a.preventDefault(),a.stopPropagation&&a.stopPropagation(),a.stopImmediatePropagation&&a.stopImmediatePropagation(),ce=!1,!1},!0);var Tt=function(t){if(x){t=t.touches?t.touches[0]:t;var e=Rn(t.clientX,t.clientY);if(e){var n={};for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[st]._onDragOver(n)}}},Ln=function(t){x&&x.parentNode[st]._isOutsideThisEl(t.target)};function P(a,t){if(!(a&&a.nodeType&&a.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(a));this.el=a,this.options=t=ht({},t),a[st]=this;var e={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(a.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return tn(a,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(o,s){o.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:P.supportPointer!==!1&&"PointerEvent"in window,emptyInsertThreshold:5};Kt.initializePlugins(this,a,e);for(var n in e)!(n in t)&&(t[n]=e[n]);en(t);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=t.forceFallback?!1:Fn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?R(a,"pointerdown",this._onTapStart):(R(a,"mousedown",this._onTapStart),R(a,"touchstart",this._onTapStart)),this.nativeDraggable&&(R(a,"dragover",this),R(a,"dragenter",this)),de.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),ht(this,Nn())}P.prototype={constructor:P,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(jt=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,x):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,i=this.options,r=i.preventOnFilter,o=t.type,s=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,l=(s||t).target,u=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,c=i.filter;if(Xn(n),!x&&!(/mousedown|pointerdown/.test(o)&&t.button!==0||i.disabled)&&!u.isContentEditable&&(l=bt(l,i.draggable,n,!1),!(l&&l.animated)&&re!==l)){if($t=J(l),Xt=J(l,i.draggable),typeof c=="function"){if(c.call(this,t,l,this)){lt({sortable:e,rootEl:u,name:"filter",targetEl:l,toEl:n,fromEl:n}),ut("filter",e,{evt:t}),r&&t.cancelable&&t.preventDefault();return}}else if(c&&(c=c.split(",").some(function(d){if(d=bt(u,d.trim(),n,!1),d)return lt({sortable:e,rootEl:d,name:"filter",targetEl:l,fromEl:n,toEl:n}),ut("filter",e,{evt:t}),!0}),c)){r&&t.cancelable&&t.preventDefault();return}i.handle&&!bt(u,i.handle,n,!1)||this._prepareDragStart(t,s,l)}}},_prepareDragStart:function(t,e,n){var i=this,r=i.el,o=i.options,s=r.ownerDocument,l;if(n&&!x&&n.parentNode===r){var u=Z(n);if(W=r,x=n,et=x.parentNode,At=x.nextSibling,re=n,Zt=o.group,P.dragged=x,Pt={target:x,clientX:(e||t).clientX,clientY:(e||t).clientY},Be=Pt.clientX-u.left,Ve=Pt.clientY-u.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,x.style["will-change"]="all",l=function(){if(ut("delayEnded",i,{evt:t}),P.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!Fe&&i.nativeDraggable&&(x.draggable=!0),i._triggerDragStart(t,e),lt({sortable:i,name:"choose",originalEvent:t}),Y(x,o.chosenClass,!0)},o.ignore.split(",").forEach(function(c){Je(x,c.trim(),Se)}),R(s,"dragover",Tt),R(s,"mousemove",Tt),R(s,"touchmove",Tt),R(s,"mouseup",i._onDrop),R(s,"touchend",i._onDrop),R(s,"touchcancel",i._onDrop),Fe&&this.nativeDraggable&&(this.options.touchStartThreshold=4,x.draggable=!0),ut("delayStart",this,{evt:t}),o.delay&&(!o.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(zt||St))){if(P.eventCanceled){this._onDrop();return}R(s,"mouseup",i._disableDelayedDrag),R(s,"touchend",i._disableDelayedDrag),R(s,"touchcancel",i._disableDelayedDrag),R(s,"mousemove",i._delayedDragTouchMoveHandler),R(s,"touchmove",i._delayedDragTouchMoveHandler),o.supportPointer&&R(s,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(l,o.delay)}else l()}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){x&&Se(x),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;F(t,"mouseup",this._disableDelayedDrag),F(t,"touchend",this._disableDelayedDrag),F(t,"touchcancel",this._disableDelayedDrag),F(t,"mousemove",this._delayedDragTouchMoveHandler),F(t,"touchmove",this._delayedDragTouchMoveHandler),F(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?R(document,"pointermove",this._onTouchMove):e?R(document,"touchmove",this._onTouchMove):R(document,"mousemove",this._onTouchMove):(R(x,"dragend",this),R(W,"dragstart",this._onDragStart));try{document.selection?oe(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Mt=!1,W&&x){ut("dragStarted",this,{evt:e}),this.nativeDraggable&&R(document,"dragover",Ln);var n=this.options;!t&&Y(x,n.dragClass,!1),Y(x,n.ghostClass,!0),P.active=this,t&&this._appendGhost(),lt({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(gt){this._lastX=gt.clientX,this._lastY=gt.clientY,nn();for(var t=document.elementFromPoint(gt.clientX,gt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(gt.clientX,gt.clientY),t!==e);)e=t;if(x.parentNode[st]._isOutsideThisEl(t),e)do{if(e[st]){var n=void 0;if(n=e[st]._onDragOver({clientX:gt.clientX,clientY:gt.clientY,target:t,rootEl:e}),n&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);rn()}},_onTouchMove:function(t){if(Pt){var e=this.options,n=e.fallbackTolerance,i=e.fallbackOffset,r=t.touches?t.touches[0]:t,o=N&&It(N,!0),s=N&&o&&o.a,l=N&&o&&o.d,u=qt&&it&&Le(it),c=(r.clientX-Pt.clientX+i.x)/(s||1)+(u?u[0]-xe[0]:0)/(s||1),d=(r.clientY-Pt.clientY+i.y)/(l||1)+(u?u[1]-xe[1]:0)/(l||1);if(!P.active&&!Mt){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))=0&&(lt({rootEl:et,name:"add",toEl:et,fromEl:W,originalEvent:t}),lt({sortable:this,name:"remove",toEl:et,originalEvent:t}),lt({rootEl:et,name:"sort",toEl:et,fromEl:W,originalEvent:t}),lt({sortable:this,name:"sort",toEl:et,originalEvent:t})),at&&at.save()):pt!==$t&&pt>=0&&(lt({sortable:this,name:"update",toEl:et,originalEvent:t}),lt({sortable:this,name:"sort",toEl:et,originalEvent:t})),P.active&&((pt==null||pt===-1)&&(pt=$t,wt=Xt),lt({sortable:this,name:"end",toEl:et,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){ut("nulling",this),W=x=et=N=At=K=re=Et=Pt=gt=Vt=pt=wt=$t=Xt=jt=Wt=at=Zt=P.dragged=P.ghost=P.clone=P.active=null,fe.forEach(function(t){t.checked=!0}),fe.length=be=ye=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":x&&(this._onDragOver(t),kn(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,n=this.el.children,i=0,r=n.length,o=this.options;in.right+i||a.clientX<=n.right&&a.clientY>n.bottom&&a.clientX>=n.left:a.clientX>n.right&&a.clientY>n.top||a.clientX<=n.right&&a.clientY>n.bottom+i}function Gn(a,t,e,n,i,r,o,s){var l=n?a.clientY:a.clientX,u=n?e.height:e.width,c=n?e.top:e.left,d=n?e.bottom:e.right,f=!1;if(!o){if(s&&aec+u*r/2:ld-ae)return-Wt}else if(l>c+u*(1-i)/2&&ld-u*r/2)?l>c+u/2?1:-1:0}function Un(a){return J(x)1&&(I.forEach(function(s){r.addAnimationState({target:s,rect:dt?Z(s):o}),ge(s),s.fromRect=o,n.removeAnimationState(s)}),dt=!1,Jn(!this.options.removeCloneOnHide,i))},dragOverCompleted:function(e){var n=e.sortable,i=e.isOwner,r=e.insertion,o=e.activeSortable,s=e.parentEl,l=e.putSortable,u=this.options;if(r){if(i&&o._hideClone(),Lt=!1,u.animation&&I.length>1&&(dt||!i&&!o.options.sort&&!l)){var c=Z(H,!1,!0,!0);I.forEach(function(f){f!==H&&(ke(f,c),s.appendChild(f))}),dt=!0}if(!i)if(dt||ee(),I.length>1){var d=te;o._showClone(n),o.options.animation&&!te&&d&&ft.forEach(function(f){o.addAnimationState({target:f,rect:kt}),f.fromRect=kt,f.thisAnimationDuration=null})}else o._showClone(n)}},dragOverAnimationCapture:function(e){var n=e.dragRect,i=e.isOwner,r=e.activeSortable;if(I.forEach(function(s){s.thisAnimationDuration=null}),r.options.animation&&!i&&r.multiDrag.isMultiDrag){kt=ht({},n);var o=It(H,!0);kt.top-=o.f,kt.left-=o.e}},dragOverAnimationComplete:function(){dt&&(dt=!1,ee())},drop:function(e){var n=e.originalEvent,i=e.rootEl,r=e.parentEl,o=e.sortable,s=e.dispatchSortableEvent,l=e.oldIndex,u=e.putSortable,c=u||this.sortable;if(n){var d=this.options,f=r.children;if(!Nt)if(d.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),Y(H,d.selectedClass,!~I.indexOf(H)),~I.indexOf(H))I.splice(I.indexOf(H),1),Rt=null,Bt({sortable:o,rootEl:i,name:"deselect",targetEl:H,originalEvt:n});else{if(I.push(H),Bt({sortable:o,rootEl:i,name:"select",targetEl:H,originalEvt:n}),n.shiftKey&&Rt&&o.el.contains(Rt)){var b=J(Rt),v=J(H);if(~b&&~v&&b!==v){var h,y;for(v>b?(y=b,h=v):(y=v,h=b+1);y1){var O=Z(H),D=J(H,":not(."+this.options.selectedClass+")");if(!Lt&&d.animation&&(H.thisAnimationDuration=null),c.captureAnimationState(),!Lt&&(d.animation&&(H.fromRect=O,I.forEach(function(w){if(w.thisAnimationDuration=null,w!==H){var _=dt?Z(w):O;w.fromRect=_,c.addAnimationState({target:w,rect:_})}})),ee(),I.forEach(function(w){f[D]?r.insertBefore(w,f[D]):r.appendChild(w),D++}),l===J(H))){var E=!1;I.forEach(function(w){if(w.sortableIndex!==J(w)){E=!0;return}}),E&&s("update")}I.forEach(function(w){ge(w)}),c.animateAll()}mt=c}(i===r||u&&u.lastPutMode!=="clone")&&ft.forEach(function(w){w.parentNode&&w.parentNode.removeChild(w)})}},nullingGlobal:function(){this.isMultiDrag=Nt=!1,ft.length=0},destroyGlobal:function(){this._deselectMultiDrag(),F(document,"pointerup",this._deselectMultiDrag),F(document,"mouseup",this._deselectMultiDrag),F(document,"touchend",this._deselectMultiDrag),F(document,"keydown",this._checkKeyDown),F(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(e){if(!(typeof Nt<"u"&&Nt)&&mt===this.sortable&&!(e&&bt(e.target,this.options.draggable,this.sortable.el,!1))&&!(e&&e.button!==0))for(;I.length;){var n=I[0];Y(n,this.options.selectedClass,!1),I.shift(),Bt({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:n,originalEvt:e})}},_checkKeyDown:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},ht(a,{pluginName:"multiDrag",utils:{select:function(e){var n=e.parentNode[st];!n||!n.options.multiDrag||~I.indexOf(e)||(mt&&mt!==n&&(mt.multiDrag._deselectMultiDrag(),mt=n),Y(e,n.options.selectedClass,!0),I.push(e))},deselect:function(e){var n=e.parentNode[st],i=I.indexOf(e);!n||!n.options.multiDrag||!~i||(Y(e,n.options.selectedClass,!1),I.splice(i,1))}},eventProperties:function(){var e=this,n=[],i=[];return I.forEach(function(r){n.push({multiDragElement:r,index:r.sortableIndex});var o;dt&&r!==H?o=-1:dt?o=J(r,":not(."+e.options.selectedClass+")"):o=J(r),i.push({multiDragElement:r,index:o})}),{items:Sn(I),clones:[].concat(ft),oldIndicies:n,newIndicies:i}},optionListeners:{multiDragKey:function(e){return e=e.toLowerCase(),e==="ctrl"?e="Control":e.length>1&&(e=e.charAt(0).toUpperCase()+e.substr(1)),e}}})}function Jn(a,t){I.forEach(function(e,n){var i=t.children[e.sortableIndex+(a?Number(n):0)];i?t.insertBefore(e,i):t.appendChild(e)})}function He(a,t){ft.forEach(function(e,n){var i=t.children[e.sortableIndex+(a?Number(n):0)];i?t.insertBefore(e,i):t.appendChild(e)})}function ee(){I.forEach(function(a){a!==H&&a.parentNode&&a.parentNode.removeChild(a)})}P.mount(new Wn);P.mount($e,Me);const Zn=Object.freeze(Object.defineProperty({__proto__:null,MultiDrag:Kn,Sortable:P,Swap:Yn,default:P},Symbol.toStringTag,{value:"Module"})),Qn=bn(Zn);(function(a,t){(function(n,i){a.exports=i(Qn)})(typeof self<"u"?self:gn,function(e){return function(n){var i={};function r(o){if(i[o])return i[o].exports;var s=i[o]={i:o,l:!1,exports:{}};return n[o].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=i,r.d=function(o,s,l){r.o(o,s)||Object.defineProperty(o,s,{enumerable:!0,get:l})},r.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},r.t=function(o,s){if(s&1&&(o=r(o)),s&8||s&4&&typeof o=="object"&&o&&o.__esModule)return o;var l=Object.create(null);if(r.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:o}),s&2&&typeof o!="string")for(var u in o)r.d(l,u,(function(c){return o[c]}).bind(null,u));return l},r.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return r.d(s,"a",s),s},r.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},r.p="",r(r.s="fb15")}({"01f9":function(n,i,r){var o=r("2d00"),s=r("5ca1"),l=r("2aba"),u=r("32e9"),c=r("84f2"),d=r("41a0"),f=r("7f20"),b=r("38fd"),v=r("2b4c")("iterator"),h=!([].keys&&"next"in[].keys()),y="@@iterator",O="keys",D="values",E=function(){return this};n.exports=function(w,_,k,B,A,j,T){d(k,_,B);var L=function(g){if(!h&&g in U)return U[g];switch(g){case O:return function(){return new k(this,g)};case D:return function(){return new k(this,g)}}return function(){return new k(this,g)}},z=_+" Iterator",tt=A==D,Q=!1,U=w.prototype,V=U[v]||U[y]||A&&U[A],X=V||L(A),ct=A?tt?L("entries"):X:void 0,ot=_=="Array"&&U.entries||V,rt,m,p;if(ot&&(p=b(ot.call(new w)),p!==Object.prototype&&p.next&&(f(p,z,!0),!o&&typeof p[v]!="function"&&u(p,v,E))),tt&&V&&V.name!==D&&(Q=!0,X=function(){return V.call(this)}),(!o||T)&&(h||Q||!U[v])&&u(U,v,X),c[_]=X,c[z]=E,A)if(rt={values:tt?X:L(D),keys:j?X:L(O),entries:ct},T)for(m in rt)m in U||l(U,m,rt[m]);else s(s.P+s.F*(h||Q),_,rt);return rt}},"02f4":function(n,i,r){var o=r("4588"),s=r("be13");n.exports=function(l){return function(u,c){var d=String(s(u)),f=o(c),b=d.length,v,h;return f<0||f>=b?l?"":void 0:(v=d.charCodeAt(f),v<55296||v>56319||f+1===b||(h=d.charCodeAt(f+1))<56320||h>57343?l?d.charAt(f):v:l?d.slice(f,f+2):(v-55296<<10)+(h-56320)+65536)}}},"0390":function(n,i,r){var o=r("02f4")(!0);n.exports=function(s,l,u){return l+(u?o(s,l).length:1)}},"0bfb":function(n,i,r){var o=r("cb7c");n.exports=function(){var s=o(this),l="";return s.global&&(l+="g"),s.ignoreCase&&(l+="i"),s.multiline&&(l+="m"),s.unicode&&(l+="u"),s.sticky&&(l+="y"),l}},"0d58":function(n,i,r){var o=r("ce10"),s=r("e11e");n.exports=Object.keys||function(u){return o(u,s)}},1495:function(n,i,r){var o=r("86cc"),s=r("cb7c"),l=r("0d58");n.exports=r("9e1e")?Object.defineProperties:function(c,d){s(c);for(var f=l(d),b=f.length,v=0,h;b>v;)o.f(c,h=f[v++],d[h]);return c}},"214f":function(n,i,r){r("b0c5");var o=r("2aba"),s=r("32e9"),l=r("79e5"),u=r("be13"),c=r("2b4c"),d=r("520a"),f=c("species"),b=!l(function(){var h=/./;return h.exec=function(){var y=[];return y.groups={a:"7"},y},"".replace(h,"$")!=="7"}),v=function(){var h=/(?:)/,y=h.exec;h.exec=function(){return y.apply(this,arguments)};var O="ab".split(h);return O.length===2&&O[0]==="a"&&O[1]==="b"}();n.exports=function(h,y,O){var D=c(h),E=!l(function(){var j={};return j[D]=function(){return 7},""[h](j)!=7}),w=E?!l(function(){var j=!1,T=/a/;return T.exec=function(){return j=!0,null},h==="split"&&(T.constructor={},T.constructor[f]=function(){return T}),T[D](""),!j}):void 0;if(!E||!w||h==="replace"&&!b||h==="split"&&!v){var _=/./[D],k=O(u,D,""[h],function(T,L,z,tt,Q){return L.exec===d?E&&!Q?{done:!0,value:_.call(L,z,tt)}:{done:!0,value:T.call(z,L,tt)}:{done:!1}}),B=k[0],A=k[1];o(String.prototype,h,B),s(RegExp.prototype,D,y==2?function(j,T){return A.call(j,this,T)}:function(j){return A.call(j,this)})}}},"230e":function(n,i,r){var o=r("d3f4"),s=r("7726").document,l=o(s)&&o(s.createElement);n.exports=function(u){return l?s.createElement(u):{}}},"23c6":function(n,i,r){var o=r("2d95"),s=r("2b4c")("toStringTag"),l=o(function(){return arguments}())=="Arguments",u=function(c,d){try{return c[d]}catch{}};n.exports=function(c){var d,f,b;return c===void 0?"Undefined":c===null?"Null":typeof(f=u(d=Object(c),s))=="string"?f:l?o(d):(b=o(d))=="Object"&&typeof d.callee=="function"?"Arguments":b}},2621:function(n,i){i.f=Object.getOwnPropertySymbols},"2aba":function(n,i,r){var o=r("7726"),s=r("32e9"),l=r("69a8"),u=r("ca5a")("src"),c=r("fa5b"),d="toString",f=(""+c).split(d);r("8378").inspectSource=function(b){return c.call(b)},(n.exports=function(b,v,h,y){var O=typeof h=="function";O&&(l(h,"name")||s(h,"name",v)),b[v]!==h&&(O&&(l(h,u)||s(h,u,b[v]?""+b[v]:f.join(String(v)))),b===o?b[v]=h:y?b[v]?b[v]=h:s(b,v,h):(delete b[v],s(b,v,h)))})(Function.prototype,d,function(){return typeof this=="function"&&this[u]||c.call(this)})},"2aeb":function(n,i,r){var o=r("cb7c"),s=r("1495"),l=r("e11e"),u=r("613b")("IE_PROTO"),c=function(){},d="prototype",f=function(){var b=r("230e")("iframe"),v=l.length,h="<",y=">",O;for(b.style.display="none",r("fab2").appendChild(b),b.src="javascript:",O=b.contentWindow.document,O.open(),O.write(h+"script"+y+"document.F=Object"+h+"/script"+y),O.close(),f=O.F;v--;)delete f[d][l[v]];return f()};n.exports=Object.create||function(v,h){var y;return v!==null?(c[d]=o(v),y=new c,c[d]=null,y[u]=v):y=f(),h===void 0?y:s(y,h)}},"2b4c":function(n,i,r){var o=r("5537")("wks"),s=r("ca5a"),l=r("7726").Symbol,u=typeof l=="function",c=n.exports=function(d){return o[d]||(o[d]=u&&l[d]||(u?l:s)("Symbol."+d))};c.store=o},"2d00":function(n,i){n.exports=!1},"2d95":function(n,i){var r={}.toString;n.exports=function(o){return r.call(o).slice(8,-1)}},"2fdb":function(n,i,r){var o=r("5ca1"),s=r("d2c8"),l="includes";o(o.P+o.F*r("5147")(l),"String",{includes:function(c){return!!~s(this,c,l).indexOf(c,arguments.length>1?arguments[1]:void 0)}})},"32e9":function(n,i,r){var o=r("86cc"),s=r("4630");n.exports=r("9e1e")?function(l,u,c){return o.f(l,u,s(1,c))}:function(l,u,c){return l[u]=c,l}},"38fd":function(n,i,r){var o=r("69a8"),s=r("4bf8"),l=r("613b")("IE_PROTO"),u=Object.prototype;n.exports=Object.getPrototypeOf||function(c){return c=s(c),o(c,l)?c[l]:typeof c.constructor=="function"&&c instanceof c.constructor?c.constructor.prototype:c instanceof Object?u:null}},"41a0":function(n,i,r){var o=r("2aeb"),s=r("4630"),l=r("7f20"),u={};r("32e9")(u,r("2b4c")("iterator"),function(){return this}),n.exports=function(c,d,f){c.prototype=o(u,{next:s(1,f)}),l(c,d+" Iterator")}},"456d":function(n,i,r){var o=r("4bf8"),s=r("0d58");r("5eda")("keys",function(){return function(u){return s(o(u))}})},4588:function(n,i){var r=Math.ceil,o=Math.floor;n.exports=function(s){return isNaN(s=+s)?0:(s>0?o:r)(s)}},4630:function(n,i){n.exports=function(r,o){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:o}}},"4bf8":function(n,i,r){var o=r("be13");n.exports=function(s){return Object(o(s))}},5147:function(n,i,r){var o=r("2b4c")("match");n.exports=function(s){var l=/./;try{"/./"[s](l)}catch{try{return l[o]=!1,!"/./"[s](l)}catch{}}return!0}},"520a":function(n,i,r){var o=r("0bfb"),s=RegExp.prototype.exec,l=String.prototype.replace,u=s,c="lastIndex",d=function(){var v=/a/,h=/b*/g;return s.call(v,"a"),s.call(h,"a"),v[c]!==0||h[c]!==0}(),f=/()??/.exec("")[1]!==void 0,b=d||f;b&&(u=function(h){var y=this,O,D,E,w;return f&&(D=new RegExp("^"+y.source+"$(?!\\s)",o.call(y))),d&&(O=y[c]),E=s.call(y,h),d&&E&&(y[c]=y.global?E.index+E[0].length:O),f&&E&&E.length>1&&l.call(E[0],D,function(){for(w=1;w1?arguments[1]:void 0)}}),r("9c6c")("includes")},6821:function(n,i,r){var o=r("626a"),s=r("be13");n.exports=function(l){return o(s(l))}},"69a8":function(n,i){var r={}.hasOwnProperty;n.exports=function(o,s){return r.call(o,s)}},"6a99":function(n,i,r){var o=r("d3f4");n.exports=function(s,l){if(!o(s))return s;var u,c;if(l&&typeof(u=s.toString)=="function"&&!o(c=u.call(s))||typeof(u=s.valueOf)=="function"&&!o(c=u.call(s))||!l&&typeof(u=s.toString)=="function"&&!o(c=u.call(s)))return c;throw TypeError("Can't convert object to primitive value")}},7333:function(n,i,r){var o=r("0d58"),s=r("2621"),l=r("52a7"),u=r("4bf8"),c=r("626a"),d=Object.assign;n.exports=!d||r("79e5")(function(){var f={},b={},v=Symbol(),h="abcdefghijklmnopqrst";return f[v]=7,h.split("").forEach(function(y){b[y]=y}),d({},f)[v]!=7||Object.keys(d({},b)).join("")!=h})?function(b,v){for(var h=u(b),y=arguments.length,O=1,D=s.f,E=l.f;y>O;)for(var w=c(arguments[O++]),_=D?o(w).concat(D(w)):o(w),k=_.length,B=0,A;k>B;)E.call(w,A=_[B++])&&(h[A]=w[A]);return h}:d},7726:function(n,i){var r=n.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=r)},"77f1":function(n,i,r){var o=r("4588"),s=Math.max,l=Math.min;n.exports=function(u,c){return u=o(u),u<0?s(u+c,0):l(u,c)}},"79e5":function(n,i){n.exports=function(r){try{return!!r()}catch{return!0}}},"7f20":function(n,i,r){var o=r("86cc").f,s=r("69a8"),l=r("2b4c")("toStringTag");n.exports=function(u,c,d){u&&!s(u=d?u:u.prototype,l)&&o(u,l,{configurable:!0,value:c})}},8378:function(n,i){var r=n.exports={version:"2.6.5"};typeof __e=="number"&&(__e=r)},"84f2":function(n,i){n.exports={}},"86cc":function(n,i,r){var o=r("cb7c"),s=r("c69a"),l=r("6a99"),u=Object.defineProperty;i.f=r("9e1e")?Object.defineProperty:function(d,f,b){if(o(d),f=l(f,!0),o(b),s)try{return u(d,f,b)}catch{}if("get"in b||"set"in b)throw TypeError("Accessors not supported!");return"value"in b&&(d[f]=b.value),d}},"9b43":function(n,i,r){var o=r("d8e8");n.exports=function(s,l,u){if(o(s),l===void 0)return s;switch(u){case 1:return function(c){return s.call(l,c)};case 2:return function(c,d){return s.call(l,c,d)};case 3:return function(c,d,f){return s.call(l,c,d,f)}}return function(){return s.apply(l,arguments)}}},"9c6c":function(n,i,r){var o=r("2b4c")("unscopables"),s=Array.prototype;s[o]==null&&r("32e9")(s,o,{}),n.exports=function(l){s[o][l]=!0}},"9def":function(n,i,r){var o=r("4588"),s=Math.min;n.exports=function(l){return l>0?s(o(l),9007199254740991):0}},"9e1e":function(n,i,r){n.exports=!r("79e5")(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},a352:function(n,i){n.exports=e},a481:function(n,i,r){var o=r("cb7c"),s=r("4bf8"),l=r("9def"),u=r("4588"),c=r("0390"),d=r("5f1b"),f=Math.max,b=Math.min,v=Math.floor,h=/\$([$&`']|\d\d?|<[^>]*>)/g,y=/\$([$&`']|\d\d?)/g,O=function(D){return D===void 0?D:String(D)};r("214f")("replace",2,function(D,E,w,_){return[function(A,j){var T=D(this),L=A==null?void 0:A[E];return L!==void 0?L.call(A,T,j):w.call(String(T),A,j)},function(B,A){var j=_(w,B,this,A);if(j.done)return j.value;var T=o(B),L=String(this),z=typeof A=="function";z||(A=String(A));var tt=T.global;if(tt){var Q=T.unicode;T.lastIndex=0}for(var U=[];;){var V=d(T,L);if(V===null||(U.push(V),!tt))break;var X=String(V[0]);X===""&&(T.lastIndex=c(L,l(T.lastIndex),Q))}for(var ct="",ot=0,rt=0;rt=ot&&(ct+=L.slice(ot,p)+G,ot=p+m.length)}return ct+L.slice(ot)}];function k(B,A,j,T,L,z){var tt=j+B.length,Q=T.length,U=y;return L!==void 0&&(L=s(L),U=h),w.call(z,U,function(V,X){var ct;switch(X.charAt(0)){case"$":return"$";case"&":return B;case"`":return A.slice(0,j);case"'":return A.slice(tt);case"<":ct=L[X.slice(1,-1)];break;default:var ot=+X;if(ot===0)return V;if(ot>Q){var rt=v(ot/10);return rt===0?V:rt<=Q?T[rt-1]===void 0?X.charAt(1):T[rt-1]+X.charAt(1):V}ct=T[ot-1]}return ct===void 0?"":ct})}})},aae3:function(n,i,r){var o=r("d3f4"),s=r("2d95"),l=r("2b4c")("match");n.exports=function(u){var c;return o(u)&&((c=u[l])!==void 0?!!c:s(u)=="RegExp")}},ac6a:function(n,i,r){for(var o=r("cadf"),s=r("0d58"),l=r("2aba"),u=r("7726"),c=r("32e9"),d=r("84f2"),f=r("2b4c"),b=f("iterator"),v=f("toStringTag"),h=d.Array,y={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},O=s(y),D=0;Dh;)if(y=b[h++],y!=y)return!0}else for(;v>h;h++)if((u||h in b)&&b[h]===d)return u||h||0;return!u&&-1}}},c649:function(n,i,r){(function(o){r.d(i,"c",function(){return b}),r.d(i,"a",function(){return d}),r.d(i,"b",function(){return l}),r.d(i,"d",function(){return f}),r("a481");function s(){return typeof window<"u"?window.console:o.console}var l=s();function u(v){var h=Object.create(null);return function(O){var D=h[O];return D||(h[O]=v(O))}}var c=/-(\w)/g,d=u(function(v){return v.replace(c,function(h,y){return y?y.toUpperCase():""})});function f(v){v.parentElement!==null&&v.parentElement.removeChild(v)}function b(v,h,y){var O=y===0?v.children[0]:v.children[y-1].nextSibling;v.insertBefore(h,O)}}).call(this,r("c8ba"))},c69a:function(n,i,r){n.exports=!r("9e1e")&&!r("79e5")(function(){return Object.defineProperty(r("230e")("div"),"a",{get:function(){return 7}}).a!=7})},c8ba:function(n,i){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch{typeof window=="object"&&(r=window)}n.exports=r},ca5a:function(n,i){var r=0,o=Math.random();n.exports=function(s){return"Symbol(".concat(s===void 0?"":s,")_",(++r+o).toString(36))}},cadf:function(n,i,r){var o=r("9c6c"),s=r("d53b"),l=r("84f2"),u=r("6821");n.exports=r("01f9")(Array,"Array",function(c,d){this._t=u(c),this._i=0,this._k=d},function(){var c=this._t,d=this._k,f=this._i++;return!c||f>=c.length?(this._t=void 0,s(1)):d=="keys"?s(0,f):d=="values"?s(0,c[f]):s(0,[f,c[f]])},"values"),l.Arguments=l.Array,o("keys"),o("values"),o("entries")},cb7c:function(n,i,r){var o=r("d3f4");n.exports=function(s){if(!o(s))throw TypeError(s+" is not an object!");return s}},ce10:function(n,i,r){var o=r("69a8"),s=r("6821"),l=r("c366")(!1),u=r("613b")("IE_PROTO");n.exports=function(c,d){var f=s(c),b=0,v=[],h;for(h in f)h!=u&&o(f,h)&&v.push(h);for(;d.length>b;)o(f,h=d[b++])&&(~l(v,h)||v.push(h));return v}},d2c8:function(n,i,r){var o=r("aae3"),s=r("be13");n.exports=function(l,u,c){if(o(u))throw TypeError("String#"+c+" doesn't accept regex!");return String(s(l))}},d3f4:function(n,i){n.exports=function(r){return typeof r=="object"?r!==null:typeof r=="function"}},d53b:function(n,i){n.exports=function(r,o){return{value:o,done:!!r}}},d8e8:function(n,i){n.exports=function(r){if(typeof r!="function")throw TypeError(r+" is not a function!");return r}},e11e:function(n,i){n.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},f559:function(n,i,r){var o=r("5ca1"),s=r("9def"),l=r("d2c8"),u="startsWith",c=""[u];o(o.P+o.F*r("5147")(u),"String",{startsWith:function(f){var b=l(this,f,u),v=s(Math.min(arguments.length>1?arguments[1]:void 0,b.length)),h=String(f);return c?c.call(b,h,v):b.slice(v,v+h.length)===h}})},f6fd:function(n,i){(function(r){var o="currentScript",s=r.getElementsByTagName("script");o in r||Object.defineProperty(r,o,{get:function(){try{throw new Error}catch(c){var l,u=(/.*at [^\(]*\((.*):.+:.+\)$/ig.exec(c.stack)||[!1])[1];for(l in s)if(s[l].src==u||s[l].readyState=="interactive")return s[l];return null}}})})(document)},f751:function(n,i,r){var o=r("5ca1");o(o.S+o.F,"Object",{assign:r("7333")})},fa5b:function(n,i,r){n.exports=r("5537")("native-function-to-string",Function.toString)},fab2:function(n,i,r){var o=r("7726").document;n.exports=o&&o.documentElement},fb15:function(n,i,r){if(r.r(i),typeof window<"u"){r("f6fd");var o;(o=window.document.currentScript)&&(o=o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(r.p=o[1])}r("f751"),r("f559"),r("ac6a"),r("cadf"),r("456d");function s(m){if(Array.isArray(m))return m}function l(m,p){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(m)))){var g=[],S=!0,M=!1,$=void 0;try{for(var G=m[Symbol.iterator](),q;!(S=(q=G.next()).done)&&(g.push(q.value),!(p&&g.length===p));S=!0);}catch(yt){M=!0,$=yt}finally{try{!S&&G.return!=null&&G.return()}finally{if(M)throw $}}return g}}function u(m,p){(p==null||p>m.length)&&(p=m.length);for(var g=0,S=new Array(p);g=$?M.length:M.indexOf(q)});return g?G.filter(function(q){return q!==-1}):G}function B(m,p){var g=this;this.$nextTick(function(){return g.$emit(m.toLowerCase(),p)})}function A(m){var p=this;return function(g){p.realList!==null&&p["onDrag"+m](g),B.call(p,m,g)}}function j(m){return["transition-group","TransitionGroup"].includes(m)}function T(m){if(!m||m.length!==1)return!1;var p=f(m,1),g=p[0].componentOptions;return g?j(g.tag):!1}function L(m,p,g){return m[g]||(p[g]?p[g]():void 0)}function z(m,p,g){var S=0,M=0,$=L(p,g,"header");$&&(S=$.length,m=m?[].concat(y($),y(m)):y($));var G=L(p,g,"footer");return G&&(M=G.length,m=m?[].concat(y(m),y(G)):y(G)),{children:m,headerOffset:S,footerOffset:M}}function tt(m,p){var g=null,S=function(Jt,on){g=w(g,Jt,on)},M=Object.keys(m).filter(function(yt){return yt==="id"||yt.startsWith("data-")}).reduce(function(yt,Jt){return yt[Jt]=m[Jt],yt},{});if(S("attrs",M),!p)return g;var $=p.on,G=p.props,q=p.attrs;return S("on",$),S("props",G),Object.assign(g.attrs,q),g}var Q=["Start","Add","Remove","Update","End"],U=["Choose","Unchoose","Sort","Filter","Clone"],V=["Move"].concat(Q,U).map(function(m){return"on"+m}),X=null,ct={options:Object,list:{type:Array,required:!1,default:null},value:{type:Array,required:!1,default:null},noTransitionOnDrag:{type:Boolean,default:!1},clone:{type:Function,default:function(p){return p}},element:{type:String,default:"div"},tag:{type:String,default:null},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null}},ot={name:"draggable",inheritAttrs:!1,props:ct,data:function(){return{transitionMode:!1,noneFunctionalComponentMode:!1}},render:function(p){var g=this.$slots.default;this.transitionMode=T(g);var S=z(g,this.$slots,this.$scopedSlots),M=S.children,$=S.headerOffset,G=S.footerOffset;this.headerOffset=$,this.footerOffset=G;var q=tt(this.$attrs,this.componentData);return p(this.getTag(),q,M)},created:function(){this.list!==null&&this.value!==null&&E.b.error("Value and list props are mutually exclusive! Please set one or another."),this.element!=="div"&&E.b.warn("Element props is deprecated please use tag props instead. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#element-props"),this.options!==void 0&&E.b.warn("Options props is deprecated, add sortable options directly as vue.draggable item, or use v-bind. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#options-props")},mounted:function(){var p=this;if(this.noneFunctionalComponentMode=this.getTag().toLowerCase()!==this.$el.nodeName.toLowerCase()&&!this.getIsFunctional(),this.noneFunctionalComponentMode&&this.transitionMode)throw new Error("Transition-group inside component is not supported. Please alter tag value or remove transition-group. Current tag value: ".concat(this.getTag()));var g={};Q.forEach(function($){g["on"+$]=A.call(p,$)}),U.forEach(function($){g["on"+$]=B.bind(p,$)});var S=Object.keys(this.$attrs).reduce(function($,G){return $[Object(E.a)(G)]=p.$attrs[G],$},{}),M=Object.assign({},this.options,S,g,{onMove:function(G,q){return p.onDragMove(G,q)}});!("draggable"in M)&&(M.draggable=">*"),this._sortable=new D.a(this.rootContainer,M),this.computeIndexes()},beforeDestroy:function(){this._sortable!==void 0&&this._sortable.destroy()},computed:{rootContainer:function(){return this.transitionMode?this.$el.children[0]:this.$el},realList:function(){return this.list?this.list:this.value}},watch:{options:{handler:function(p){this.updateOptions(p)},deep:!0},$attrs:{handler:function(p){this.updateOptions(p)},deep:!0},realList:function(){this.computeIndexes()}},methods:{getIsFunctional:function(){var p=this._vnode.fnOptions;return p&&p.functional},getTag:function(){return this.tag||this.element},updateOptions:function(p){for(var g in p){var S=Object(E.a)(g);V.indexOf(S)===-1&&this._sortable.option(S,p[g])}},getChildrenNodes:function(){if(this.noneFunctionalComponentMode)return this.$children[0].$slots.default;var p=this.$slots.default;return this.transitionMode?p[0].child.$slots.default:p},computeIndexes:function(){var p=this;this.$nextTick(function(){p.visibleIndexes=k(p.getChildrenNodes(),p.rootContainer.children,p.transitionMode,p.footerOffset)})},getUnderlyingVm:function(p){var g=F(this.getChildrenNodes()||[],p);if(g===-1)return null;var S=this.realList[g];return{index:g,element:S}},getUnderlyingPotencialDraggableComponent:function(p){var g=p.__vue__;return!g||!g.$options||!j(g.$options._componentTag)?!("realList"in g)&&g.$children.length===1&&"realList"in g.$children[0]?g.$children[0]:g:g.$parent},emitChanges:function(p){var g=this;this.$nextTick(function(){g.$emit("change",p)})},alterList:function(p){if(this.list){p(this.list);return}var g=y(this.value);p(g),this.$emit("input",g)},spliceList:function(){var p=arguments,g=function(M){return M.splice.apply(M,y(p))};this.alterList(g)},updatePosition:function(p,g){var S=function($){return $.splice(g,0,$.splice(p,1)[0])};this.alterList(S)},getRelatedContextFromMoveEvent:function(p){var g=p.to,S=p.related,M=this.getUnderlyingPotencialDraggableComponent(g);if(!M)return{component:M};var $=M.realList,G={list:$,component:M};if(g!==S&&$&&M.getUnderlyingVm){var q=M.getUnderlyingVm(S);if(q)return Object.assign(q,G)}return G},getVmIndex:function(p){var g=this.visibleIndexes,S=g.length;return p>S-1?S:g[p]},getComponent:function(){return this.$slots.default[0].componentInstance},resetTransitionData:function(p){if(!(!this.noTransitionOnDrag||!this.transitionMode)){var g=this.getChildrenNodes();g[p].data=null;var S=this.getComponent();S.children=[],S.kept=void 0}},onDragStart:function(p){this.context=this.getUnderlyingVm(p.item),p.item._underlying_vm_=this.clone(this.context.element),X=p.item},onDragAdd:function(p){var g=p.item._underlying_vm_;if(g!==void 0){Object(E.d)(p.item);var S=this.getVmIndex(p.newIndex);this.spliceList(S,0,g),this.computeIndexes();var M={element:g,newIndex:S};this.emitChanges({added:M})}},onDragRemove:function(p){if(Object(E.c)(this.rootContainer,p.item,p.oldIndex),p.pullMode==="clone"){Object(E.d)(p.clone);return}var g=this.context.index;this.spliceList(g,1);var S={element:this.context.element,oldIndex:g};this.resetTransitionData(g),this.emitChanges({removed:S})},onDragUpdate:function(p){Object(E.d)(p.item),Object(E.c)(p.from,p.item,p.oldIndex);var g=this.context.index,S=this.getVmIndex(p.newIndex);this.updatePosition(g,S);var M={element:this.context.element,oldIndex:g,newIndex:S};this.emitChanges({moved:M})},updateProperty:function(p,g){p.hasOwnProperty(g)&&(p[g]+=this.headerOffset)},computeFutureIndex:function(p,g){if(!p.element)return 0;var S=y(g.to.children).filter(function(q){return q.style.display!=="none"}),M=S.indexOf(g.related),$=p.component.getVmIndex(M),G=S.indexOf(X)!==-1;return G||!g.willInsertAfter?$:$+1},onDragMove:function(p,g){var S=this.move;if(!S||!this.realList)return!0;var M=this.getRelatedContextFromMoveEvent(p),$=this.context,G=this.computeFutureIndex(M,p);Object.assign($,{futureIndex:G});var q=Object.assign({},p,{relatedContext:M,draggedContext:$});return S(q,g)},onDragEnd:function(){this.computeIndexes(),X=null}}};typeof window<"u"&&"Vue"in window&&window.Vue.component("draggable",ot);var rt=ot;i.default=rt}}).default})})(Ye);var qn=Ye.exports;const tr=mn(qn);const er={name:"StructuredDataBuilder",mixins:[Fieldtype],components:{"structured-data-object":We,"preset-modal":hn,draggable:tr},props:{value:{type:Array,default:()=>[{specialProps:{context:"https://schema.org",type:"",id:""},fields:[]}]},baseUrl:{type:String,default:""},meta:{type:Object,default:()=>({})}},data(){return{schemas:this.value.length?this.value:[{specialProps:{context:"https://schema.org",type:"",id:""},fields:[]}],showPreview:!1,showPresetModal:!1,collapsedSchemas:{}}},computed:{baseUrl(){var a;return((a=this.config)==null?void 0:a.base_url)||""},preview(){return je(this.schemas)},selectOptions(){return[{value:"string",label:"String"},{value:"numeric",label:"Numeric"},{value:"array",label:"Array"},{value:"object",label:"Object"},{value:"object_array",label:"Object Array"},{value:"data_object",label:"Data Object (Term)"}]},taxonomyTerms(){var a;return((a=this.meta)==null?void 0:a.taxonomy_terms)||[]},taxonomyTermOptions(){return this.taxonomyTerms.map(a=>({label:a.title,value:"@dataObject::"+a.slug}))},presets(){var a;return((a=this.meta)==null?void 0:a.presets)||[]},presetsEnabled(){var a;return((a=this.meta)==null?void 0:a.presets_enabled)||!1}},watch:{schemas:{deep:!0,handler(a){this.$emit("input",a)}}},methods:{addSchema(){this.schemas.push({specialProps:{context:"https://schema.org",type:"",id:""},fields:[]})},addField(a){a.fields.push({key:"",type:"string",value:"",values:[],fields:[]})},moveFieldUp(a,t){if(a>0){const e=[...t.fields],n=e[a-1];e[a-1]=e[a],e[a]=n,t.fields=e}},moveFieldDown(a,t){if(a1?e("button",{staticClass:"btn-danger",on:{click:function(r){return t.removeSchema(i)}}},[t._v(" "+t._s(t.__("Remove Schema"))+" ")]):t._e()]),e("div",{directives:[{name:"show",rawName:"v-show",value:!t.isSchemaCollapsed(i),expression:"!isSchemaCollapsed(schemaIndex)"}],staticClass:"p-4"},[e("div",{staticClass:"space-y-3"},[n.specialProps?e("div",[e("div",{staticClass:"mb-3"},[e("label",{staticClass:"text-gray-600 mb-1 block"},[t._v("@context")]),e("input",{directives:[{name:"model",rawName:"v-model",value:n.specialProps.context,expression:"schema.specialProps.context"}],staticClass:"input-text w-full bg-gray-50",attrs:{type:"text",readonly:""},domProps:{value:n.specialProps.context},on:{input:function(r){r.target.composing||t.$set(n.specialProps,"context",r.target.value)}}})]),e("div",{staticClass:"mb-3"},[e("label",{staticClass:"text-gray-600 mb-1 block"},[t._v("@type")]),e("input",{directives:[{name:"model",rawName:"v-model",value:n.specialProps.type,expression:"schema.specialProps.type"}],staticClass:"input-text w-full",attrs:{type:"text",placeholder:"e.g. Organization, Product, BlogPosting"},domProps:{value:n.specialProps.type},on:{input:function(r){r.target.composing||t.$set(n.specialProps,"type",r.target.value)}}})]),e("div",{staticClass:"mb-4"},[e("label",{staticClass:"text-gray-600 mb-1 block"},[t._v("@id")]),e("div",{staticClass:"flex gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:n.specialProps.id,expression:"schema.specialProps.id"}],staticClass:"input-text flex-1",attrs:{type:"text",placeholder:t.suggestedId(n)},domProps:{value:n.specialProps.id},on:{input:function(r){r.target.composing||t.$set(n.specialProps,"id",r.target.value)}}}),e("button",{staticClass:"btn-primary",on:{click:function(r){return t.useDefaultId(n)}}},[t._v("Use Default")])])])]):t._e(),e("div",{staticClass:"mt-4"},[e("h4",{staticClass:"text-gray-600 mb-2"},[t._v(t._s(t.__("Fields")))]),e("draggable",{key:i,attrs:{handle:".drag-handle"},on:{end:t.onEnd},model:{value:n.fields,callback:function(r){t.$set(n,"fields",r)},expression:"schema.fields"}},t._l(n.fields,function(r,o){return e("div",{key:o,staticClass:"mb-2 border rounded bg-gray-50"},[e("div",{staticClass:"structured-data-schema-field-header px-2 py-2 flex justify-between items-center border-b rounded-t-lg cursor-drag drag-handle"},[e("button",{directives:[{name:"show",rawName:"v-show",value:o>0,expression:"index > 0"}],staticClass:"btn btn-secondary",on:{click:function(s){return t.moveFieldUp(o,n)}}},[t._v("↑ Move Up")]),e("button",{directives:[{name:"show",rawName:"v-show",value:o{r.type=s.value,t.handleTypeChange(r)}},model:{value:r.type,callback:function(s){t.$set(r,"type",s)},expression:"field.type"}})],1)]),e("div",{staticClass:"mt-3"},[r.type==="string"?e("input",{directives:[{name:"model",rawName:"v-model",value:r.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"text",placeholder:"Enter value"},domProps:{value:r.value},on:{input:function(s){s.target.composing||t.$set(r,"value",s.target.value)}}}):t._e(),r.type==="numeric"?e("input",{directives:[{name:"model",rawName:"v-model",value:r.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"number",placeholder:"Enter value"},domProps:{value:r.value},on:{input:function(s){s.target.composing||t.$set(r,"value",s.target.value)}}}):r.type==="array"?e("div",{staticClass:"mt-2"},[e("div",{staticClass:"flex flex-col gap-2 space-y-2"},t._l(r.values,function(s,l){return e("div",{key:l,staticClass:"flex items-center gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:r.values[l],expression:"field.values[valueIndex]"}],staticClass:"input-text flex-1",attrs:{type:"text"},domProps:{value:r.values[l]},on:{input:function(u){u.target.composing||t.$set(r.values,l,u.target.value)}}}),e("button",{staticClass:"btn-danger inline-flex items-center px-2 py-1",on:{click:function(u){return t.removeArrayValue(r,l)}}},[e("span",[t._v(t._s(t.__("Remove")))])])])}),0),e("button",{staticClass:"btn-primary mt-2 text-sm",on:{click:function(s){return t.addArrayValue(r)}}},[t._v(" "+t._s(t.__("Add Value"))+" ")])]):r.type==="object"?e("div",{staticClass:"mt-2"},[e("structured-data-object",{model:{value:r.value,callback:function(s){t.$set(r,"value",s)},expression:"field.value"}})],1):r.type==="object_array"?e("div",{staticClass:"mt-2"},[e("div",{staticClass:"flex flex-col gap-2 space-y-2"},t._l(r.values,function(s,l){return e("div",{key:l,staticClass:"flex flex-col gap-2"},[e("structured-data-object",{model:{value:r.values[l],callback:function(u){t.$set(r.values,l,u)},expression:"field.values[valueIndex]"}}),e("button",{staticClass:"btn-danger inline-flex self-end items-center px-2 py-1",on:{click:function(u){return t.removeArrayValue(r,l)}}},[e("span",[t._v(t._s(t.__("Remove")))])])],1)}),0),e("button",{staticClass:"btn-primary mt-2 text-sm",on:{click:function(s){return t.addArrayValue(r)}}},[t._v(" "+t._s(t.__("Add Value"))+" ")])]):r.type==="data_object"?e("div",{staticClass:"mt-2"},[e("v-select",{attrs:{options:t.taxonomyTermOptions},on:{input:s=>{r.value=s.value}},model:{value:r.value,callback:function(s){t.$set(r,"value",s)},expression:"field.value"}})],1):t._e()]),e("div",{staticClass:"flex justify-end mt-3"},[e("button",{staticClass:"btn-danger",on:{click:function(s){return t.removeField(n,o)}}},[t._v(" "+t._s(t.__("Remove Field"))+" ")])])])])}),0),e("button",{staticClass:"btn-primary mt-2",on:{click:function(r){return t.addField(n)}}},[t._v(" "+t._s(t.__("Add Field"))+" ")])],1)])])])}),e("div",{staticClass:"flex gap-2 mt-4"},[e("button",{staticClass:"btn-primary",on:{click:t.addSchema}},[t._v(t._s(t.__("Add Schema")))]),t.presetsEnabled&&t.presets.length>0?e("button",{staticClass:"btn-preset",on:{click:function(n){t.showPresetModal=!0}}},[t._v(" "+t._s(t.__("Add Preset"))+" ")]):t._e(),e("button",{staticClass:"btn",on:{click:t.togglePreview}},[t._v(" "+t._s(t.showPreview?t.__("Hide Preview"):t.__("Show Preview"))+" ")])]),t.showPreview?e("div",{staticClass:"mt-4"},[e("pre",{staticClass:"bg-gray-50 p-4 rounded-lg overflow-x-auto"},[t._v(t._s(t.preview))])]):t._e()],2),e("preset-modal",{attrs:{visible:t.showPresetModal,presets:t.presets,"has-existing-schemas":t.schemas.length>0},on:{close:function(n){t.showPresetModal=!1},"preset-selected":t.handlePresetSelected}})],1)},rr=[],ar=_t(er,nr,rr,!1,null,null,null,null);const or=ar.exports;const ir={mixins:[Fieldtype],data(){return{selectedTemplates:[],showPreview:!0,isPrettyPrint:!0,loading:!1,error:null}},computed:{hasTemplates(){return this.templateIds&&this.templateIds.length>0},templateIds(){var a;return((a=this.$store.state.publish.base.values)==null?void 0:a.structured_data_templates)||[]},currentEntryId(){return this.$store.state.publish.base.values.id}},watch:{templateIds:{immediate:!0,handler(a){if(!a||!a.length){this.selectedTemplates=[];return}this.fetchTemplateData(a)}}},methods:{async fetchTemplateData(a){this.loading=!0,this.error=null;try{const t=await this.$axios.get("/cp/justbetter/structured-data",{params:{ids:a,entry_id:this.currentEntryId}});this.selectedTemplates=t.data.map(e=>({...e,isCollapsed:!1}))}catch(t){console.error("Error fetching template data:",t),this.error="Failed to load template data. Please try again."}finally{this.loading=!1}},formatJson(a){return je(a)}}};var sr=function(){var t=this,e=t._self._c;return t.hasTemplates?e("div",{staticClass:"structured-data-preview mt-4"},[e("div",{staticClass:"flex justify-end items-center mb-4"},[e("div",{staticClass:"flex gap-2"},[e("button",{staticClass:"btn",on:{click:function(n){t.showPreview=!t.showPreview}}},[t._v(" "+t._s(t.showPreview?t.__("Hide Preview"):t.__("Show Preview"))+" ")]),t.showPreview?e("button",{staticClass:"btn",on:{click:function(n){t.isPrettyPrint=!t.isPrettyPrint}}},[t._v(" "+t._s(t.isPrettyPrint?t.__("Raw"):t.__("Pretty"))+" ")]):t._e()])]),t.loading?e("div",{staticClass:"text-center py-4"},[e("loading-graphic")],1):t.error?e("div",{staticClass:"text-red-500 py-4"},[t._v(" "+t._s(t.error)+" ")]):t.showPreview?e("div",{staticClass:"space-y-4"},t._l(t.selectedTemplates,function(n){return e("div",{key:n.id,staticClass:"border rounded p-4"},[e("div",{staticClass:"flex justify-between items-center mb-2"},[e("h4",{staticClass:"font-bold"},[t._v(t._s(n.title))]),e("button",{staticClass:"btn-close",on:{click:function(i){n.isCollapsed=!n.isCollapsed}}},[t._v(" "+t._s(n.isCollapsed?"+":"-")+" ")])]),e("div",{directives:[{name:"show",rawName:"v-show",value:!n.isCollapsed,expression:"!template.isCollapsed"}]},[t.isPrettyPrint?e("pre",{staticClass:"structured-data-preview-code p-4 rounded overflow-auto"},[t._v(t._s(t.formatJson(n.structuredData)))]):e("pre",{staticClass:"structured-data-preview-code p-4 rounded overflow-auto"},[t._v(t._s(JSON.stringify(n.structuredData)))])])])}),0):t._e()]):t._e()},lr=[],ur=_t(ir,sr,lr,!1,null,null,null,null);const cr=ur.exports;const dr={name:"StructuredDataObjectBuilder",mixins:[Fieldtype],components:{"structured-data-object":We},props:{value:{type:Object,default:()=>({fields:[]})},baseUrl:{type:String,default:""},meta:{type:Object,default:()=>({})}},data(){return{schema:this.value||{fields:[]},showPreview:!1,collapsedSchemas:{}}},computed:{baseUrl(){var a;return((a=this.config)==null?void 0:a.base_url)||""},preview(){return je(this.schema)},selectOptions(){return[{value:"string",label:"String"},{value:"numeric",label:"Numeric"},{value:"array",label:"Array"},{value:"object",label:"Object"}]}},watch:{schema:{deep:!0,handler(a){this.$emit("input",a)}}},methods:{addField(){this.schema.fields.push({key:"",type:"string",value:"",values:[],fields:[]})},removeField(a){this.schema.fields.splice(a,1)},addArrayValue(a){a.values||(a.values=[]),a.values.push("")},removeArrayValue(a,t){a.values.splice(t,1)},validateKey(a){a.key=a.key.replace(/[^a-zA-Z0-9@:-]/g,"")},handleTypeChange(a){a.type==="object"?a.value={specialProps:{type:"",id:""},fields:[]}:a.type==="array"?a.values=[]:a.value=""},togglePreview(){this.showPreview=!this.showPreview}}};var fr=function(){var t=this,e=t._self._c;return e("div",{staticClass:"structured-data-builder"},[e("div",{staticClass:"flex-1"},[t.schema?e("div",{staticClass:"structured-data-schema mb-6 rounded-lg shadow-sm border"},[e("div",{staticClass:"px-4 py-2 bg-gray-50 border-b rounded-t-lg flex justify-between items-center"},[e("div",{staticClass:"flex items-center gap-2 cursor-pointer"},[e("h3",{staticClass:"font-bold text-lg"},[t._v(t._s(t.__("Object Data Builder")))])])]),e("div",{staticClass:"p-4"},[e("div",{staticClass:"space-y-3"},[e("h4",{staticClass:"text-gray-600 mb-2"},[t._v(t._s(t.__("Fields")))]),t._l(t.schema.fields,function(n,i){return e("div",{key:i,staticClass:"mb-2 border rounded bg-gray-50"},[e("div",{staticClass:"p-3"},[e("div",{staticClass:"grid grid-cols-1 md:grid-cols-3 gap-3"},[e("div",{staticClass:"col-span-2"},[e("label",{staticClass:"text-gray-600 mb-1 block"},[t._v(t._s(t.__("Key")))]),e("input",{directives:[{name:"model",rawName:"v-model",value:n.key,expression:"field.key"}],staticClass:"input-text w-full",attrs:{type:"text"},domProps:{value:n.key},on:{input:[function(r){r.target.composing||t.$set(n,"key",r.target.value)},function(r){return t.validateKey(n)}]}})]),e("div",[e("label",{staticClass:"text-gray-600 mb-1 block"},[t._v(t._s(t.__("Type")))]),e("v-select",{attrs:{options:t.selectOptions},on:{input:r=>{n.type=r.value,t.handleTypeChange(n)}},model:{value:n.type,callback:function(r){t.$set(n,"type",r)},expression:"field.type"}})],1)]),e("div",{staticClass:"mt-3"},[n.type==="string"?e("input",{directives:[{name:"model",rawName:"v-model",value:n.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"text",placeholder:"Enter value"},domProps:{value:n.value},on:{input:function(r){r.target.composing||t.$set(n,"value",r.target.value)}}}):t._e(),n.type==="numeric"?e("input",{directives:[{name:"model",rawName:"v-model",value:n.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"number",placeholder:"Enter value"},domProps:{value:n.value},on:{input:function(r){r.target.composing||t.$set(n,"value",r.target.value)}}}):n.type==="array"?e("div",{staticClass:"mt-2"},[e("div",{staticClass:"flex flex-col gap-2 space-y-2"},t._l(n.values,function(r,o){return e("div",{key:o,staticClass:"flex items-center gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:n.values[o],expression:"field.values[valueIndex]"}],staticClass:"input-text flex-1",attrs:{type:"text"},domProps:{value:n.values[o]},on:{input:function(s){s.target.composing||t.$set(n.values,o,s.target.value)}}}),e("button",{staticClass:"btn-danger inline-flex items-center px-2 py-1",on:{click:function(s){return t.removeArrayValue(n,o)}}},[e("span",[t._v(t._s(t.__("Remove")))])])])}),0),e("button",{staticClass:"btn-primary mt-2 text-sm",on:{click:function(r){return t.addArrayValue(n)}}},[t._v(" "+t._s(t.__("Add Value"))+" ")])]):n.type==="object"?e("div",{staticClass:"mt-2"},[e("structured-data-object",{attrs:{"base-url":t.baseUrl,"field-key":n.key},model:{value:n.value,callback:function(r){t.$set(n,"value",r)},expression:"field.value"}})],1):t._e()]),e("div",{staticClass:"flex justify-end mt-3"},[e("button",{staticClass:"btn-danger",on:{click:function(r){return t.removeField(i)}}},[t._v(" "+t._s(t.__("Remove Field"))+" ")])])])])}),e("button",{staticClass:"btn-primary mt-2",on:{click:function(n){return t.addField()}}},[t._v(" "+t._s(t.__("Add Field"))+" ")])],2)])]):t._e(),e("div",{staticClass:"flex gap-2 mt-4"},[e("button",{staticClass:"btn",on:{click:t.togglePreview}},[t._v(" "+t._s(t.showPreview?t.__("Hide Preview"):t.__("Show Preview"))+" ")])]),t.showPreview?e("div",{staticClass:"mt-4"},[e("pre",{staticClass:"bg-gray-50 p-4 rounded-lg overflow-x-auto"},[t._v(t._s(t.preview))])]):t._e()])])},pr=[],vr=_t(dr,fr,pr,!1,null,null,null,null);const hr=vr.exports;const gr={mixins:[Fieldtype],data(){return{showChildren:{},variablesCollapsed:!1,tooltipVisible:!1,tooltipStyle:{position:"absolute",top:"0",left:"0"}}},computed:{variables(){var a;return((a=this.meta)==null?void 0:a.variables)||{config:{},entry:[],term:[]}},hasVariables(){return Object.keys(this.variables).length>0}},methods:{toggleVariables(){this.variablesCollapsed=!this.variablesCollapsed},toggleChildren(a){this.$set(this.showChildren,a,!this.showChildren[a])},copyVariable(a,t){navigator.clipboard?navigator.clipboard.writeText(a).then(()=>{console.log("Variable copied to clipboard:",a),this.tooltipVisible=!0,this.tooltipStyle.top=`${t.layerY}px`,this.tooltipStyle.left=`${t.layerX}px`,setTimeout(()=>{this.tooltipVisible=!1},2e3)}).catch(e=>{console.error("Could not copy text: ",e)}):console.warn("Clipboard API not supported or not running in a secure context.")}}};var mr=function(){var t=this,e=t._self._c;return e("div",{staticClass:"variables-panel"},[e("div",{staticClass:"p-2 border-b flex justify-between items-center bg-gray-50 cursor-pointer",on:{click:t.toggleVariables}},[e("h3",{staticClass:"font-bold"},[t._v(t._s(t.__("Available Variables")))]),e("div",{staticClass:"text-gray-500 hover:text-gray-700 rotate-180"},[e("div",{class:["chevron",{"chevron-up":!t.variablesCollapsed}]})])]),t.variablesCollapsed?t._e():e("div",{staticClass:"structured-data-variables-list py-4"},[t.hasVariables?e("div",{staticClass:"grid grid-cols-2"},t._l(t.variables,function(n,i){return e("div",{key:n},[n.length?e("div",{staticClass:"mb-4"},[e("h4",{staticClass:"font-semibold mb-2 text-gray-700 capitalize",domProps:{textContent:t._s(i)}}),t._l(n,function(r){return e("div",{key:r.name,staticClass:"variable-item p-1 rounded"},[r.children&&r.children.length?e("div",[e("div",{staticClass:"mb-2 cursor-pointer flex justify-between items-center text-sm",on:{click:function(o){return t.toggleChildren(r.name)}}},[e("div",[t._v(t._s(r.description))]),e("div",[t._v(t._s(t.showChildren[r.name]?"▼":"►"))])]),t.showChildren[r.name]?e("div",t._l(r.children,function(o){return e("div",{key:o.name,staticClass:"variable-item p-1 cursor-pointer rounded",on:{click:function(s){return t.copyVariable("{{ "+o.name+" }}",s)}}},[e("div",{staticClass:"text-sm"},[t._v(t._s(o.description))]),e("div",{staticClass:"text-xs text-gray-500"},[t._v(t._s(o.name))])])}),0):t._e()]):e("div",{staticClass:"variable-item cursor-pointer",on:{click:function(o){return t.copyVariable("{{ "+r.name+" }}",o)}}},[e("div",{staticClass:"text-sm"},[t._v(t._s(r.description))]),e("div",{staticClass:"text-xs text-gray-500"},[t._v(t._s(r.name))])])])})],2):t._e()])}),0):e("div",{staticClass:"text-gray-500 text-sm"},[t._v(" "+t._s(t.__("No variables available for this collection."))+" ")])]),e("div",{directives:[{name:"show",rawName:"v-show",value:t.tooltipVisible,expression:"tooltipVisible"}],staticClass:"tooltip",style:t.tooltipStyle},[t._v("Copied!")])])},br=[],yr=_t(gr,mr,br,!1,null,"35391c50",null,null);const xr=yr.exports;Statamic.booting(()=>{Statamic.component("structured_data_builder-fieldtype",or),Statamic.component("structured_data_preview-fieldtype",cr),Statamic.component("structured_data_object_builder-fieldtype",hr),Statamic.component("structured_data_available_variables-fieldtype",xr)}); +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(m){return b(m)||v(m)||c(m)||h()}var O=r("a352"),D=r.n(O),E=r("c649");function w(m,p,g){return g===void 0||(m=m||{},m[p]=g),m}function _(m,p){return m.map(function(g){return g.elm}).indexOf(p)}function k(m,p,g,S){if(!m)return[];var M=m.map(function(q){return q.elm}),$=p.length-S,G=y(p).map(function(q,yt){return yt>=$?M.length:M.indexOf(q)});return g?G.filter(function(q){return q!==-1}):G}function B(m,p){var g=this;this.$nextTick(function(){return g.$emit(m.toLowerCase(),p)})}function A(m){var p=this;return function(g){p.realList!==null&&p["onDrag"+m](g),B.call(p,m,g)}}function j(m){return["transition-group","TransitionGroup"].includes(m)}function T(m){if(!m||m.length!==1)return!1;var p=f(m,1),g=p[0].componentOptions;return g?j(g.tag):!1}function L(m,p,g){return m[g]||(p[g]?p[g]():void 0)}function z(m,p,g){var S=0,M=0,$=L(p,g,"header");$&&(S=$.length,m=m?[].concat(y($),y(m)):y($));var G=L(p,g,"footer");return G&&(M=G.length,m=m?[].concat(y(m),y(G)):y(G)),{children:m,headerOffset:S,footerOffset:M}}function tt(m,p){var g=null,S=function(Jt,on){g=w(g,Jt,on)},M=Object.keys(m).filter(function(yt){return yt==="id"||yt.startsWith("data-")}).reduce(function(yt,Jt){return yt[Jt]=m[Jt],yt},{});if(S("attrs",M),!p)return g;var $=p.on,G=p.props,q=p.attrs;return S("on",$),S("props",G),Object.assign(g.attrs,q),g}var Q=["Start","Add","Remove","Update","End"],U=["Choose","Unchoose","Sort","Filter","Clone"],V=["Move"].concat(Q,U).map(function(m){return"on"+m}),X=null,ct={options:Object,list:{type:Array,required:!1,default:null},value:{type:Array,required:!1,default:null},noTransitionOnDrag:{type:Boolean,default:!1},clone:{type:Function,default:function(p){return p}},element:{type:String,default:"div"},tag:{type:String,default:null},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null}},ot={name:"draggable",inheritAttrs:!1,props:ct,data:function(){return{transitionMode:!1,noneFunctionalComponentMode:!1}},render:function(p){var g=this.$slots.default;this.transitionMode=T(g);var S=z(g,this.$slots,this.$scopedSlots),M=S.children,$=S.headerOffset,G=S.footerOffset;this.headerOffset=$,this.footerOffset=G;var q=tt(this.$attrs,this.componentData);return p(this.getTag(),q,M)},created:function(){this.list!==null&&this.value!==null&&E.b.error("Value and list props are mutually exclusive! Please set one or another."),this.element!=="div"&&E.b.warn("Element props is deprecated please use tag props instead. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#element-props"),this.options!==void 0&&E.b.warn("Options props is deprecated, add sortable options directly as vue.draggable item, or use v-bind. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#options-props")},mounted:function(){var p=this;if(this.noneFunctionalComponentMode=this.getTag().toLowerCase()!==this.$el.nodeName.toLowerCase()&&!this.getIsFunctional(),this.noneFunctionalComponentMode&&this.transitionMode)throw new Error("Transition-group inside component is not supported. Please alter tag value or remove transition-group. Current tag value: ".concat(this.getTag()));var g={};Q.forEach(function($){g["on"+$]=A.call(p,$)}),U.forEach(function($){g["on"+$]=B.bind(p,$)});var S=Object.keys(this.$attrs).reduce(function($,G){return $[Object(E.a)(G)]=p.$attrs[G],$},{}),M=Object.assign({},this.options,S,g,{onMove:function(G,q){return p.onDragMove(G,q)}});!("draggable"in M)&&(M.draggable=">*"),this._sortable=new D.a(this.rootContainer,M),this.computeIndexes()},beforeDestroy:function(){this._sortable!==void 0&&this._sortable.destroy()},computed:{rootContainer:function(){return this.transitionMode?this.$el.children[0]:this.$el},realList:function(){return this.list?this.list:this.value}},watch:{options:{handler:function(p){this.updateOptions(p)},deep:!0},$attrs:{handler:function(p){this.updateOptions(p)},deep:!0},realList:function(){this.computeIndexes()}},methods:{getIsFunctional:function(){var p=this._vnode.fnOptions;return p&&p.functional},getTag:function(){return this.tag||this.element},updateOptions:function(p){for(var g in p){var S=Object(E.a)(g);V.indexOf(S)===-1&&this._sortable.option(S,p[g])}},getChildrenNodes:function(){if(this.noneFunctionalComponentMode)return this.$children[0].$slots.default;var p=this.$slots.default;return this.transitionMode?p[0].child.$slots.default:p},computeIndexes:function(){var p=this;this.$nextTick(function(){p.visibleIndexes=k(p.getChildrenNodes(),p.rootContainer.children,p.transitionMode,p.footerOffset)})},getUnderlyingVm:function(p){var g=_(this.getChildrenNodes()||[],p);if(g===-1)return null;var S=this.realList[g];return{index:g,element:S}},getUnderlyingPotencialDraggableComponent:function(p){var g=p.__vue__;return!g||!g.$options||!j(g.$options._componentTag)?!("realList"in g)&&g.$children.length===1&&"realList"in g.$children[0]?g.$children[0]:g:g.$parent},emitChanges:function(p){var g=this;this.$nextTick(function(){g.$emit("change",p)})},alterList:function(p){if(this.list){p(this.list);return}var g=y(this.value);p(g),this.$emit("input",g)},spliceList:function(){var p=arguments,g=function(M){return M.splice.apply(M,y(p))};this.alterList(g)},updatePosition:function(p,g){var S=function($){return $.splice(g,0,$.splice(p,1)[0])};this.alterList(S)},getRelatedContextFromMoveEvent:function(p){var g=p.to,S=p.related,M=this.getUnderlyingPotencialDraggableComponent(g);if(!M)return{component:M};var $=M.realList,G={list:$,component:M};if(g!==S&&$&&M.getUnderlyingVm){var q=M.getUnderlyingVm(S);if(q)return Object.assign(q,G)}return G},getVmIndex:function(p){var g=this.visibleIndexes,S=g.length;return p>S-1?S:g[p]},getComponent:function(){return this.$slots.default[0].componentInstance},resetTransitionData:function(p){if(!(!this.noTransitionOnDrag||!this.transitionMode)){var g=this.getChildrenNodes();g[p].data=null;var S=this.getComponent();S.children=[],S.kept=void 0}},onDragStart:function(p){this.context=this.getUnderlyingVm(p.item),p.item._underlying_vm_=this.clone(this.context.element),X=p.item},onDragAdd:function(p){var g=p.item._underlying_vm_;if(g!==void 0){Object(E.d)(p.item);var S=this.getVmIndex(p.newIndex);this.spliceList(S,0,g),this.computeIndexes();var M={element:g,newIndex:S};this.emitChanges({added:M})}},onDragRemove:function(p){if(Object(E.c)(this.rootContainer,p.item,p.oldIndex),p.pullMode==="clone"){Object(E.d)(p.clone);return}var g=this.context.index;this.spliceList(g,1);var S={element:this.context.element,oldIndex:g};this.resetTransitionData(g),this.emitChanges({removed:S})},onDragUpdate:function(p){Object(E.d)(p.item),Object(E.c)(p.from,p.item,p.oldIndex);var g=this.context.index,S=this.getVmIndex(p.newIndex);this.updatePosition(g,S);var M={element:this.context.element,oldIndex:g,newIndex:S};this.emitChanges({moved:M})},updateProperty:function(p,g){p.hasOwnProperty(g)&&(p[g]+=this.headerOffset)},computeFutureIndex:function(p,g){if(!p.element)return 0;var S=y(g.to.children).filter(function(q){return q.style.display!=="none"}),M=S.indexOf(g.related),$=p.component.getVmIndex(M),G=S.indexOf(X)!==-1;return G||!g.willInsertAfter?$:$+1},onDragMove:function(p,g){var S=this.move;if(!S||!this.realList)return!0;var M=this.getRelatedContextFromMoveEvent(p),$=this.context,G=this.computeFutureIndex(M,p);Object.assign($,{futureIndex:G});var q=Object.assign({},p,{relatedContext:M,draggedContext:$});return S(q,g)},onDragEnd:function(){this.computeIndexes(),X=null}}};typeof window<"u"&&"Vue"in window&&window.Vue.component("draggable",ot);var rt=ot;i.default=rt}}).default})})(Ye);var qn=Ye.exports;const tr=mn(qn);const er={name:"StructuredDataBuilder",mixins:[Fieldtype],components:{"structured-data-object":Xe,"preset-modal":hn,draggable:tr},props:{value:{type:Array,default:()=>[{specialProps:{context:"https://schema.org",type:"",id:""},fields:[]}]},baseUrl:{type:String,default:""},meta:{type:Object,default:()=>({})}},data(){return{schemas:this.value.length?this.value:[{specialProps:{context:"https://schema.org",type:"",id:""},fields:[]}],showPreview:!1,showPresetModal:!1,collapsedSchemas:{}}},computed:{baseUrl(){var a;return((a=this.config)==null?void 0:a.base_url)||""},preview(){return We(this.schemas)},selectOptions(){return[{value:"string",label:"String"},{value:"numeric",label:"Numeric"},{value:"array",label:"Array"},{value:"object",label:"Object"},{value:"object_array",label:"Object Array"},{value:"data_object",label:"Data Object (Term)"}]},taxonomyTerms(){var a;return((a=this.meta)==null?void 0:a.taxonomy_terms)||[]},taxonomyTermOptions(){return this.taxonomyTerms.map(a=>({label:a.title,value:"@dataObject::"+a.slug}))},presets(){var a;return((a=this.meta)==null?void 0:a.presets)||[]},presetsEnabled(){var a;return((a=this.meta)==null?void 0:a.presets_enabled)||!1}},watch:{schemas:{deep:!0,handler(a){this.$emit("input",a)}}},methods:{addSchema(){this.schemas.push({specialProps:{context:"https://schema.org",type:"",id:""},fields:[]})},addField(a){a.fields.push({key:"",type:"string",value:"",values:[],fields:[]})},moveFieldUp(a,t){if(a>0){const e=[...t.fields],n=e[a-1];e[a-1]=e[a],e[a]=n,t.fields=e}},moveFieldDown(a,t){if(a1?e("button",{staticClass:"btn-danger",on:{click:function(r){return t.removeSchema(i)}}},[t._v(" "+t._s(t.__("Remove Schema"))+" ")]):t._e()]),e("div",{directives:[{name:"show",rawName:"v-show",value:!t.isSchemaCollapsed(i),expression:"!isSchemaCollapsed(schemaIndex)"}],staticClass:"p-4"},[e("div",{staticClass:"space-y-3"},[n.specialProps?e("div",[e("div",{staticClass:"mb-3"},[e("label",{staticClass:"text-gray-600 mb-1 block"},[t._v("@context")]),e("input",{directives:[{name:"model",rawName:"v-model",value:n.specialProps.context,expression:"schema.specialProps.context"}],staticClass:"input-text w-full bg-gray-50",attrs:{type:"text",readonly:""},domProps:{value:n.specialProps.context},on:{input:function(r){r.target.composing||t.$set(n.specialProps,"context",r.target.value)}}})]),e("div",{staticClass:"mb-3"},[e("label",{staticClass:"text-gray-600 mb-1 block"},[t._v("@type")]),e("input",{directives:[{name:"model",rawName:"v-model",value:n.specialProps.type,expression:"schema.specialProps.type"}],staticClass:"input-text w-full",attrs:{type:"text",placeholder:"e.g. Organization, Product, BlogPosting"},domProps:{value:n.specialProps.type},on:{input:function(r){r.target.composing||t.$set(n.specialProps,"type",r.target.value)}}})]),e("div",{staticClass:"mb-4"},[e("label",{staticClass:"text-gray-600 mb-1 block"},[t._v("@id")]),e("div",{staticClass:"flex gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:n.specialProps.id,expression:"schema.specialProps.id"}],staticClass:"input-text flex-1",attrs:{type:"text",placeholder:t.suggestedId(n)},domProps:{value:n.specialProps.id},on:{input:function(r){r.target.composing||t.$set(n.specialProps,"id",r.target.value)}}}),e("button",{staticClass:"btn-primary",on:{click:function(r){return t.useDefaultId(n)}}},[t._v("Use Default")])])])]):t._e(),e("div",{staticClass:"mt-4"},[e("h4",{staticClass:"text-gray-600 mb-2"},[t._v(t._s(t.__("Fields")))]),e("draggable",{key:i,attrs:{handle:".drag-handle"},on:{end:t.onEnd},model:{value:n.fields,callback:function(r){t.$set(n,"fields",r)},expression:"schema.fields"}},t._l(n.fields,function(r,o){return e("div",{key:o,staticClass:"mb-2 border rounded bg-gray-50"},[e("div",{staticClass:"structured-data-schema-field-header px-2 py-2 flex justify-between items-center border-b rounded-t-lg cursor-drag drag-handle"},[e("button",{directives:[{name:"show",rawName:"v-show",value:o>0,expression:"index > 0"}],staticClass:"btn btn-secondary",on:{click:function(s){return t.moveFieldUp(o,n)}}},[t._v("↑ Move Up")]),e("button",{directives:[{name:"show",rawName:"v-show",value:o{r.type=s.value,t.handleTypeChange(r)}},model:{value:r.type,callback:function(s){t.$set(r,"type",s)},expression:"field.type"}})],1)]),e("div",{staticClass:"mt-3"},[r.type==="string"?e("input",{directives:[{name:"model",rawName:"v-model",value:r.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"text",placeholder:"Enter value"},domProps:{value:r.value},on:{input:function(s){s.target.composing||t.$set(r,"value",s.target.value)}}}):t._e(),r.type==="numeric"?e("input",{directives:[{name:"model",rawName:"v-model",value:r.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"number",placeholder:"Enter value"},domProps:{value:r.value},on:{input:function(s){s.target.composing||t.$set(r,"value",s.target.value)}}}):r.type==="array"?e("div",{staticClass:"mt-2"},[e("div",{staticClass:"flex flex-col gap-2 space-y-2"},t._l(r.values,function(s,l){return e("div",{key:l,staticClass:"flex items-center gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:r.values[l],expression:"field.values[valueIndex]"}],staticClass:"input-text flex-1",attrs:{type:"text"},domProps:{value:r.values[l]},on:{input:function(u){u.target.composing||t.$set(r.values,l,u.target.value)}}}),e("button",{staticClass:"btn-danger inline-flex items-center px-2 py-1",on:{click:function(u){return t.removeArrayValue(r,l)}}},[e("span",[t._v(t._s(t.__("Remove")))])])])}),0),e("button",{staticClass:"btn-primary mt-2 text-sm",on:{click:function(s){return t.addArrayValue(r)}}},[t._v(" "+t._s(t.__("Add Value"))+" ")])]):r.type==="object"?e("div",{staticClass:"mt-2"},[e("structured-data-object",{model:{value:r.value,callback:function(s){t.$set(r,"value",s)},expression:"field.value"}})],1):r.type==="object_array"?e("div",{staticClass:"mt-2"},[e("div",{staticClass:"flex flex-col gap-2 space-y-2"},t._l(r.values,function(s,l){return e("div",{key:l,staticClass:"flex flex-col gap-2"},[e("structured-data-object",{model:{value:r.values[l],callback:function(u){t.$set(r.values,l,u)},expression:"field.values[valueIndex]"}}),e("button",{staticClass:"btn-danger inline-flex self-end items-center px-2 py-1",on:{click:function(u){return t.removeArrayValue(r,l)}}},[e("span",[t._v(t._s(t.__("Remove")))])])],1)}),0),e("button",{staticClass:"btn-primary mt-2 text-sm",on:{click:function(s){return t.addArrayValue(r)}}},[t._v(" "+t._s(t.__("Add Value"))+" ")])]):r.type==="data_object"?e("div",{staticClass:"mt-2"},[e("v-select",{attrs:{options:t.taxonomyTermOptions},on:{input:s=>{r.value=s.value}},model:{value:r.value,callback:function(s){t.$set(r,"value",s)},expression:"field.value"}})],1):t._e()]),e("div",{staticClass:"flex justify-end mt-3"},[e("button",{staticClass:"btn-danger",on:{click:function(s){return t.removeField(n,o)}}},[t._v(" "+t._s(t.__("Remove Field"))+" ")])])])])}),0),e("button",{staticClass:"btn-primary mt-2",on:{click:function(r){return t.addField(n)}}},[t._v(" "+t._s(t.__("Add Field"))+" ")])],1)])])])}),e("div",{staticClass:"flex gap-2 mt-4"},[e("button",{staticClass:"btn-primary",on:{click:t.addSchema}},[t._v(t._s(t.__("Add Schema")))]),t.presetsEnabled&&t.presets.length>0?e("button",{staticClass:"btn-preset",on:{click:function(n){t.showPresetModal=!0}}},[t._v(" "+t._s(t.__("Add Preset"))+" ")]):t._e(),e("button",{staticClass:"btn",on:{click:t.togglePreview}},[t._v(" "+t._s(t.showPreview?t.__("Hide Preview"):t.__("Show Preview"))+" ")])]),t.showPreview?e("div",{staticClass:"mt-4"},[e("pre",{staticClass:"bg-gray-50 p-4 rounded-lg overflow-x-auto"},[t._v(t._s(t.preview))])]):t._e()],2),e("preset-modal",{attrs:{visible:t.showPresetModal,presets:t.presets,"has-existing-schemas":t.schemas.length>0},on:{close:function(n){t.showPresetModal=!1},"preset-selected":t.handlePresetSelected}})],1)},rr=[],ar=Ft(er,nr,rr,!1,null,null,null,null);const or=ar.exports;const ir={mixins:[Fieldtype],data(){return{selectedTemplates:[],showPreview:!0,isPrettyPrint:!0,loading:!1,error:null}},computed:{hasTemplates(){return this.templateIds&&this.templateIds.length>0},templateIds(){var a;return((a=this.$store.state.publish.base.values)==null?void 0:a.structured_data_templates)||[]},currentEntryId(){return this.$store.state.publish.base.values.id}},watch:{templateIds:{immediate:!0,handler(a){if(!a||!a.length){this.selectedTemplates=[];return}this.fetchTemplateData(a)}}},methods:{async fetchTemplateData(a){this.loading=!0,this.error=null;try{const t=await this.$axios.get("/cp/justbetter/structured-data",{params:{ids:a,entry_id:this.currentEntryId}});this.selectedTemplates=t.data.map(e=>({...e,isCollapsed:!1}))}catch(t){console.error("Error fetching template data:",t),this.error="Failed to load template data. Please try again."}finally{this.loading=!1}}}};var sr=function(){var t=this,e=t._self._c;return t.hasTemplates?e("div",{staticClass:"structured-data-preview mt-4"},[e("div",{staticClass:"flex justify-end items-center mb-4"},[e("div",{staticClass:"flex gap-2"},[e("button",{staticClass:"btn",on:{click:function(n){t.showPreview=!t.showPreview}}},[t._v(" "+t._s(t.showPreview?t.__("Hide Preview"):t.__("Show Preview"))+" ")]),t.showPreview?e("button",{staticClass:"btn",on:{click:function(n){t.isPrettyPrint=!t.isPrettyPrint}}},[t._v(" "+t._s(t.isPrettyPrint?t.__("Raw"):t.__("Pretty"))+" ")]):t._e()])]),t.loading?e("div",{staticClass:"text-center py-4"},[e("loading-graphic")],1):t.error?e("div",{staticClass:"text-red-500 py-4"},[t._v(" "+t._s(t.error)+" ")]):t.showPreview?e("div",{staticClass:"space-y-4"},t._l(t.selectedTemplates,function(n){return e("div",{key:n.id,staticClass:"border rounded p-4"},[e("div",{staticClass:"flex justify-between items-center mb-2"},[e("h4",{staticClass:"font-bold"},[t._v(t._s(n.title))]),e("button",{staticClass:"btn-close",on:{click:function(i){n.isCollapsed=!n.isCollapsed}}},[t._v(" "+t._s(n.isCollapsed?"+":"-")+" ")])]),e("div",{directives:[{name:"show",rawName:"v-show",value:!n.isCollapsed,expression:"!template.isCollapsed"}]},[e("pre",{staticClass:"structured-data-preview-code p-4 rounded overflow-auto"},[t._v(t._s(JSON.stringify(n.structuredData,null,t.isPrettyPrint?2:0)))])])])}),0):t._e()]):t._e()},lr=[],ur=Ft(ir,sr,lr,!1,null,null,null,null);const cr=ur.exports;const dr={name:"StructuredDataObjectBuilder",mixins:[Fieldtype],components:{"structured-data-object":Xe},props:{value:{type:Object,default:()=>({fields:[]})},baseUrl:{type:String,default:""},meta:{type:Object,default:()=>({})}},data(){return{schema:this.value||{fields:[]},showPreview:!1,collapsedSchemas:{}}},computed:{baseUrl(){var a;return((a=this.config)==null?void 0:a.base_url)||""},preview(){return We(this.schema)},selectOptions(){return[{value:"string",label:"String"},{value:"numeric",label:"Numeric"},{value:"array",label:"Array"},{value:"object",label:"Object"}]}},watch:{schema:{deep:!0,handler(a){this.$emit("input",a)}}},methods:{addField(){this.schema.fields.push({key:"",type:"string",value:"",values:[],fields:[]})},removeField(a){this.schema.fields.splice(a,1)},addArrayValue(a){a.values||(a.values=[]),a.values.push("")},removeArrayValue(a,t){a.values.splice(t,1)},validateKey(a){a.key=a.key.replace(/[^a-zA-Z0-9@:-]/g,"")},handleTypeChange(a){a.type==="object"?a.value={specialProps:{type:"",id:""},fields:[]}:a.type==="array"?a.values=[]:a.value=""},togglePreview(){this.showPreview=!this.showPreview}}};var fr=function(){var t=this,e=t._self._c;return e("div",{staticClass:"structured-data-builder"},[e("div",{staticClass:"flex-1"},[t.schema?e("div",{staticClass:"structured-data-schema mb-6 rounded-lg shadow-sm border"},[e("div",{staticClass:"px-4 py-2 bg-gray-50 border-b rounded-t-lg flex justify-between items-center"},[e("div",{staticClass:"flex items-center gap-2 cursor-pointer"},[e("h3",{staticClass:"font-bold text-lg"},[t._v(t._s(t.__("Object Data Builder")))])])]),e("div",{staticClass:"p-4"},[e("div",{staticClass:"space-y-3"},[e("h4",{staticClass:"text-gray-600 mb-2"},[t._v(t._s(t.__("Fields")))]),t._l(t.schema.fields,function(n,i){return e("div",{key:i,staticClass:"mb-2 border rounded bg-gray-50"},[e("div",{staticClass:"p-3"},[e("div",{staticClass:"grid grid-cols-1 md:grid-cols-3 gap-3"},[e("div",{staticClass:"col-span-2"},[e("label",{staticClass:"text-gray-600 mb-1 block"},[t._v(t._s(t.__("Key")))]),e("input",{directives:[{name:"model",rawName:"v-model",value:n.key,expression:"field.key"}],staticClass:"input-text w-full",attrs:{type:"text"},domProps:{value:n.key},on:{input:[function(r){r.target.composing||t.$set(n,"key",r.target.value)},function(r){return t.validateKey(n)}]}})]),e("div",[e("label",{staticClass:"text-gray-600 mb-1 block"},[t._v(t._s(t.__("Type")))]),e("v-select",{attrs:{options:t.selectOptions},on:{input:r=>{n.type=r.value,t.handleTypeChange(n)}},model:{value:n.type,callback:function(r){t.$set(n,"type",r)},expression:"field.type"}})],1)]),e("div",{staticClass:"mt-3"},[n.type==="string"?e("input",{directives:[{name:"model",rawName:"v-model",value:n.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"text",placeholder:"Enter value"},domProps:{value:n.value},on:{input:function(r){r.target.composing||t.$set(n,"value",r.target.value)}}}):t._e(),n.type==="numeric"?e("input",{directives:[{name:"model",rawName:"v-model",value:n.value,expression:"field.value"}],staticClass:"input-text w-full",attrs:{type:"number",placeholder:"Enter value"},domProps:{value:n.value},on:{input:function(r){r.target.composing||t.$set(n,"value",r.target.value)}}}):n.type==="array"?e("div",{staticClass:"mt-2"},[e("div",{staticClass:"flex flex-col gap-2 space-y-2"},t._l(n.values,function(r,o){return e("div",{key:o,staticClass:"flex items-center gap-2"},[e("input",{directives:[{name:"model",rawName:"v-model",value:n.values[o],expression:"field.values[valueIndex]"}],staticClass:"input-text flex-1",attrs:{type:"text"},domProps:{value:n.values[o]},on:{input:function(s){s.target.composing||t.$set(n.values,o,s.target.value)}}}),e("button",{staticClass:"btn-danger inline-flex items-center px-2 py-1",on:{click:function(s){return t.removeArrayValue(n,o)}}},[e("span",[t._v(t._s(t.__("Remove")))])])])}),0),e("button",{staticClass:"btn-primary mt-2 text-sm",on:{click:function(r){return t.addArrayValue(n)}}},[t._v(" "+t._s(t.__("Add Value"))+" ")])]):n.type==="object"?e("div",{staticClass:"mt-2"},[e("structured-data-object",{attrs:{"base-url":t.baseUrl,"field-key":n.key},model:{value:n.value,callback:function(r){t.$set(n,"value",r)},expression:"field.value"}})],1):t._e()]),e("div",{staticClass:"flex justify-end mt-3"},[e("button",{staticClass:"btn-danger",on:{click:function(r){return t.removeField(i)}}},[t._v(" "+t._s(t.__("Remove Field"))+" ")])])])])}),e("button",{staticClass:"btn-primary mt-2",on:{click:function(n){return t.addField()}}},[t._v(" "+t._s(t.__("Add Field"))+" ")])],2)])]):t._e(),e("div",{staticClass:"flex gap-2 mt-4"},[e("button",{staticClass:"btn",on:{click:t.togglePreview}},[t._v(" "+t._s(t.showPreview?t.__("Hide Preview"):t.__("Show Preview"))+" ")])]),t.showPreview?e("div",{staticClass:"mt-4"},[e("pre",{staticClass:"bg-gray-50 p-4 rounded-lg overflow-x-auto"},[t._v(t._s(t.preview))])]):t._e()])])},pr=[],vr=Ft(dr,fr,pr,!1,null,null,null,null);const hr=vr.exports;const gr={mixins:[Fieldtype],data(){return{showChildren:{},variablesCollapsed:!1,tooltipVisible:!1,tooltipStyle:{position:"absolute",top:"0",left:"0"}}},computed:{variables(){var a;return((a=this.meta)==null?void 0:a.variables)||{config:{},entry:[],term:[]}},hasVariables(){return Object.keys(this.variables).length>0}},methods:{toggleVariables(){this.variablesCollapsed=!this.variablesCollapsed},toggleChildren(a){this.$set(this.showChildren,a,!this.showChildren[a])},copyVariable(a,t){navigator.clipboard?navigator.clipboard.writeText(a).then(()=>{console.log("Variable copied to clipboard:",a),this.tooltipVisible=!0,this.tooltipStyle.top=`${t.layerY}px`,this.tooltipStyle.left=`${t.layerX}px`,setTimeout(()=>{this.tooltipVisible=!1},2e3)}).catch(e=>{console.error("Could not copy text: ",e)}):console.warn("Clipboard API not supported or not running in a secure context.")}}};var mr=function(){var t=this,e=t._self._c;return e("div",{staticClass:"variables-panel"},[e("div",{staticClass:"p-2 border-b flex justify-between items-center bg-gray-50 cursor-pointer",on:{click:t.toggleVariables}},[e("h3",{staticClass:"font-bold"},[t._v(t._s(t.__("Available Variables")))]),e("div",{staticClass:"text-gray-500 hover:text-gray-700 rotate-180"},[e("div",{class:["chevron",{"chevron-up":!t.variablesCollapsed}]})])]),t.variablesCollapsed?t._e():e("div",{staticClass:"structured-data-variables-list py-4"},[t.hasVariables?e("div",{staticClass:"grid grid-cols-2"},t._l(t.variables,function(n,i){return e("div",{key:n},[n.length?e("div",{staticClass:"mb-4"},[e("h4",{staticClass:"font-semibold mb-2 text-gray-700 capitalize",domProps:{textContent:t._s(i)}}),t._l(n,function(r){return e("div",{key:r.name,staticClass:"variable-item p-1 rounded"},[r.children&&r.children.length?e("div",[e("div",{staticClass:"mb-2 cursor-pointer flex justify-between items-center text-sm",on:{click:function(o){return t.toggleChildren(r.name)}}},[e("div",[t._v(t._s(r.description))]),e("div",[t._v(t._s(t.showChildren[r.name]?"▼":"►"))])]),t.showChildren[r.name]?e("div",t._l(r.children,function(o){return e("div",{key:o.name,staticClass:"variable-item p-1 cursor-pointer rounded",on:{click:function(s){return t.copyVariable("{{ "+o.name+" }}",s)}}},[e("div",{staticClass:"text-sm"},[t._v(t._s(o.description))]),e("div",{staticClass:"text-xs text-gray-500"},[t._v(t._s(o.name))])])}),0):t._e()]):e("div",{staticClass:"variable-item cursor-pointer",on:{click:function(o){return t.copyVariable("{{ "+r.name+" }}",o)}}},[e("div",{staticClass:"text-sm"},[t._v(t._s(r.description))]),e("div",{staticClass:"text-xs text-gray-500"},[t._v(t._s(r.name))])])])})],2):t._e()])}),0):e("div",{staticClass:"text-gray-500 text-sm"},[t._v(" "+t._s(t.__("No variables available for this collection."))+" ")])]),e("div",{directives:[{name:"show",rawName:"v-show",value:t.tooltipVisible,expression:"tooltipVisible"}],staticClass:"tooltip",style:t.tooltipStyle},[t._v("Copied!")])])},br=[],yr=Ft(gr,mr,br,!1,null,"35391c50",null,null);const xr=yr.exports;Statamic.booting(()=>{Statamic.component("structured_data_builder-fieldtype",or),Statamic.component("structured_data_preview-fieldtype",cr),Statamic.component("structured_data_object_builder-fieldtype",hr),Statamic.component("structured_data_available_variables-fieldtype",xr)}); diff --git a/resources/dist/build/manifest.json b/resources/dist/build/manifest.json index 06dd8b9..7709cd3 100644 --- a/resources/dist/build/manifest.json +++ b/resources/dist/build/manifest.json @@ -12,7 +12,7 @@ "css": [ "assets/statamic-structured-data-61a769e2.css" ], - "file": "assets/statamic-structured-data-9a9eb249.js", + "file": "assets/statamic-structured-data-c2cc3bfe.js", "isEntry": true, "src": "resources/js/statamic-structured-data.js" } diff --git a/resources/js/components/fieldtypes/ReplicatorFieldMapper.vue b/resources/js/components/fieldtypes/ReplicatorFieldMapper.vue new file mode 100644 index 0000000..4dd9b29 --- /dev/null +++ b/resources/js/components/fieldtypes/ReplicatorFieldMapper.vue @@ -0,0 +1,307 @@ + + + + diff --git a/resources/js/components/fieldtypes/StructuredDataPreview.vue b/resources/js/components/fieldtypes/StructuredDataPreview.vue index ef62f17..57497ff 100644 --- a/resources/js/components/fieldtypes/StructuredDataPreview.vue +++ b/resources/js/components/fieldtypes/StructuredDataPreview.vue @@ -39,8 +39,7 @@
-
{{ formatJson(template.structuredData) }}
-
{{ JSON.stringify(template.structuredData) }}
+
{{ JSON.stringify(template.structuredData, null, isPrettyPrint ? 2 : 0) }}
@@ -48,8 +47,6 @@ diff --git a/src/Http/Controllers/StructuredDataController.php b/src/Http/Controllers/StructuredDataController.php index e1c3eb1..f787d2e 100644 --- a/src/Http/Controllers/StructuredDataController.php +++ b/src/Http/Controllers/StructuredDataController.php @@ -5,6 +5,7 @@ use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Justbetter\StatamicStructuredData\Parser\StructuredDataParser; +use Justbetter\StatamicStructuredData\Services\StructuredDataService; use Statamic\Contracts\Data\Augmentable; use Statamic\Contracts\Entries\Entry as EntryContract; use Statamic\Contracts\Taxonomies\Term as TermContract; @@ -77,12 +78,13 @@ public function getTemplates(Request $request): JsonResponse return null; } - $parsedData = $this->parseAntlersInData($structuredData, $contentEntry); + $structuredDataService = app(StructuredDataService::class); + $transformedData = $structuredDataService->parseAndTransformSchemas($structuredData, $contentEntry); return [ 'id' => $entry->id(), 'title' => $entry->get('title'), - 'structuredData' => $parsedData, + 'structuredData' => $transformedData, ]; }) ->filter() diff --git a/src/Services/ReplicatorFieldService.php b/src/Services/ReplicatorFieldService.php new file mode 100644 index 0000000..622e6d1 --- /dev/null +++ b/src/Services/ReplicatorFieldService.php @@ -0,0 +1,300 @@ +> */ + public function getReplicatorFields(EntryContract $dataTemplate): array + { + // @phpstan-ignore-next-line + $collection = $dataTemplate->use_for_collection; + // @phpstan-ignore-next-line + $taxonomy = $dataTemplate->use_for_taxonomy; + + if (! $collection && ! $taxonomy) { + return []; + } + + $blueprints = $collection + ? $collection->entryBlueprints() + : $taxonomy->termBlueprints(); + + if (! $blueprints || ! $blueprints->first()) { + return []; + } + + $fieldsArray = $this->extractFieldsFromBlueprints($blueprints); + + return $this->parseReplicatorFields($fieldsArray); + } + + /** + * @param SupportCollection $blueprints + * @return array> + */ + protected function extractFieldsFromBlueprints(SupportCollection $blueprints): array + { + return $blueprints->reduce(function (array $carry, Blueprint $blueprint): array { + $items = $blueprint->fields()->items(); + + if ($items instanceof \Illuminate\Support\Collection) { + $items = $items->all(); + } + + return array_merge($carry, is_array($items) ? $items : []); + }, []); + } + + /** + * @param array> $fieldsArray + * @return array> + */ + protected function parseReplicatorFields(array $fieldsArray): array + { + $replicatorFields = []; + + foreach ($fieldsArray as $field) { + $field = $this->normalizeField($field); + + if (! is_array($field)) { + continue; + } + + /** @var array $field */ + $fieldConfig = is_array($field['field'] ?? null) ? $field['field'] : []; + /** @var array $fieldConfig */ + $fieldType = is_string($fieldConfig['type'] ?? null) ? $fieldConfig['type'] : null; + + if ($fieldType !== 'replicator') { + continue; + } + + $replicatorField = $this->buildReplicatorField($field, $fieldConfig); + + if ($replicatorField) { + $replicatorFields[] = $replicatorField; + } + } + + return $replicatorFields; + } + + /** + * @param mixed $field + * @return array|null + */ + protected function normalizeField($field): ?array + { + if (is_object($field) && method_exists($field, 'toArray')) { + $field = $field->toArray(); + } + + if (! is_array($field)) { + return null; + } + + $normalized = []; + + foreach ($field as $key => $value) { + if (! is_string($key)) { + return null; + } + + $normalized[$key] = $value; + } + + return $normalized; + } + + /** + * @param array $field + * @param array $fieldConfig + * @return array|null + */ + protected function buildReplicatorField(array $field, array $fieldConfig): ?array + { + $handle = $field['handle'] ?? null; + + if (! is_string($handle)) { + return null; + } + + $display = is_string($fieldConfig['display'] ?? null) ? $fieldConfig['display'] : $handle; + $sets = is_array($fieldConfig['sets'] ?? null) ? $fieldConfig['sets'] : []; + $setOptions = $this->parseSets($sets); + + return [ + 'handle' => $handle, + 'display' => $display, + 'sets' => $setOptions, + ]; + } + + /** + * @param array $sets + * @return array> + */ + protected function parseSets(array $sets): array + { + $setOptions = []; + + foreach ($sets as $setHandle => $setConfig) { + if (! is_array($setConfig)) { + continue; + } + + /** @var array $setConfig */ + $setDisplay = is_string($setConfig['display'] ?? null) ? $setConfig['display'] : $setHandle; + $setFields = is_array($setConfig['fields'] ?? null) ? $setConfig['fields'] : []; + $nestedSets = is_array($setConfig['sets'] ?? null) ? $setConfig['sets'] : []; + + $fieldOptions = $this->parseSetFields($setFields); + + if (! empty($nestedSets)) { + $nestedFields = $this->extractFieldsFromNestedSets($nestedSets); + $fieldOptions = array_merge($fieldOptions, $nestedFields); + } + + $setOptions[] = [ + 'value' => $setHandle, + 'label' => $setDisplay, + 'fields' => $fieldOptions, + ]; + } + + return $setOptions; + } + + /** + * @param array $nestedSets + * @return array> + */ + protected function extractFieldsFromNestedSets(array $nestedSets): array + { + $allFields = []; + + foreach ($nestedSets as $nestedSetConfig) { + if (! is_array($nestedSetConfig)) { + continue; + } + + /** @var array $nestedSetConfig */ + $nestedSetFields = is_array($nestedSetConfig['fields'] ?? null) ? $nestedSetConfig['fields'] : []; + $fields = $this->parseSetFields($nestedSetFields); + $allFields = array_merge($allFields, $fields); + $deeperNestedSets = is_array($nestedSetConfig['sets'] ?? null) ? $nestedSetConfig['sets'] : []; + + if (! empty($deeperNestedSets)) { + $deeperFields = $this->extractFieldsFromNestedSets($deeperNestedSets); + $allFields = array_merge($allFields, $deeperFields); + } + } + + return $allFields; + } + + /** + * @param array $setFields + * @return array> + */ + protected function parseSetFields(array $setFields): array + { + $fieldOptions = []; + + foreach ($setFields as $setFieldKey => $setFieldData) { + $fieldData = $this->extractFieldData($setFieldKey, $setFieldData); + + if (! $fieldData) { + continue; + } + + /** @var string $setFieldHandle */ + /** @var array $setFieldConfig */ + [$setFieldHandle, $setFieldConfig] = $fieldData; + + $setFieldDisplay = is_string($setFieldConfig['display'] ?? null) ? $setFieldConfig['display'] : $setFieldHandle; + $setFieldType = is_string($setFieldConfig['type'] ?? null) ? $setFieldConfig['type'] : null; + + if ($this->isFieldTypeEligible($setFieldType)) { + $fieldOptions[] = [ + 'value' => $setFieldHandle, + 'label' => $setFieldDisplay, + 'type' => $setFieldType, + ]; + } + } + + return $fieldOptions; + } + + /** + * @param int|string $setFieldKey + * @param mixed $setFieldData + * @return array{0: string, 1: array}|null + */ + protected function extractFieldData($setFieldKey, $setFieldData): ?array + { + if (is_array($setFieldData) && isset($setFieldData['handle'])) { + $handle = $setFieldData['handle']; + + if (! is_string($handle)) { + return null; + } + + $fieldConfig = is_array($setFieldData['field'] ?? null) ? $setFieldData['field'] : []; + /** @var array $fieldConfig */ + $fieldConfig = $fieldConfig; + + return [ + $handle, + $fieldConfig, + ]; + } + + if (is_string($setFieldKey) && is_array($setFieldData)) { + /** @var array $config */ + $config = $setFieldData; + + return [ + $setFieldKey, + $config, + ]; + } + + return null; + } + + protected function isFieldTypeEligible(?string $fieldType): bool + { + if ($fieldType === null) { + return false; + } + + $eligibleFieldTypes = [ + 'text', + 'textarea', + 'markdown', + 'assets', + 'bard', + 'toggle', + 'integer', + 'float', + 'slug', + 'date', + 'time', + 'datetime', + 'entries', + 'terms', + 'users', + 'link', + 'url', + ]; + + return in_array($fieldType, $eligibleFieldTypes, true); + } +} diff --git a/src/Services/StructuredDataService.php b/src/Services/StructuredDataService.php index 5389692..f47866c 100644 --- a/src/Services/StructuredDataService.php +++ b/src/Services/StructuredDataService.php @@ -4,6 +4,7 @@ use Justbetter\StatamicStructuredData\Parser\StructuredDataParser; use Statamic\Contracts\Entries\Entry as EntryContract; +use Statamic\Contracts\Taxonomies\Term as TermContract; use Statamic\Entries\Entry as EntryModel; use Statamic\Facades\Entry as EntryFacade; use Statamic\Structures\Page; @@ -86,11 +87,31 @@ public function formatJsonLd(array $schema, bool $json = false): string ); } + /** + * @param mixed $schemas + * @return array> + */ + public function parseAndTransformSchemas($schemas, EntryContract|Page|LocalizedTerm|TermContract|null $item = null): array + { + $parsedData = $this->parser->parse($schemas, $item); + $transformedData = []; + + if (is_array($parsedData)) { + foreach ($parsedData as $schema) { + if (is_array($schema)) { + $transformedData[] = $this->transformSchema($schema, $item); + } + } + } + + return $transformedData; + } + /** * @param array $schema * @return array */ - public function transformSchema(array $schema): array + public function transformSchema(array $schema, EntryContract|Page|LocalizedTerm|TermContract|null $item = null): array { $result = []; @@ -114,26 +135,70 @@ public function transformSchema(array $schema): array } $key = $field['key']; + $transformedValue = $this->transformField($field, $item, $result); - if ($field['type'] === 'array' && isset($field['values'])) { - $result[$key] = $field['values']; - } elseif ($field['type'] === 'object' && isset($field['value'])) { - $result[$key] = $this->transformSchema($field['value']); - } elseif ($field['type'] === 'object_array' && isset($field['values'])) { - foreach ($field['values'] as $value) { - $result[$key][] = $this->transformSchema($value); - } - } elseif ($field['type'] === 'numeric' && isset($field['value'])) { - $result[$key] = (float) $field['value']; - } else { - $result[$key] = $field['value'] ?? null; + if ($transformedValue === null) { + continue; } + + $result[$key] = $transformedValue; } } return $result; } + protected function isAssociativeArray(array $array): bool + { + if (empty($array)) { + return false; + } + + return array_keys($array) !== range(0, count($array) - 1); + } + + /** + * @param array $field + * @param array $result + */ + protected function transformField(array $field, EntryContract|Page|LocalizedTerm|TermContract|null $item = null, array &$result = []): mixed + { + $type = $field['type'] ?? null; + + // Handle object and object_array types that need recursive schema transformation + if ($type === 'object' && isset($field['value']) && is_array($field['value'])) { + return $this->transformSchema($field['value'], $item); + } + + if ($type === 'object_array' && isset($field['values']) && is_array($field['values'])) { + $output = []; + foreach ($field['values'] as $value) { + if (is_array($value)) { + $output[] = $this->transformSchema($value, $item); + } + } + + return $output; + } + + // Use transformer factory for all other field types + $transformer = $this->transformerFactory->getTransformer(is_string($type) ? $type : null); + $transformedValue = $transformer->transform($field, $item); + + // Handle flat mode for replicator_object_array + if ($type === 'replicator_object_array' + && isset($field['config']['flat']) + && $field['config']['flat'] === true + && is_array($transformedValue) + && $this->isAssociativeArray($transformedValue)) { + $result = array_merge($result, $transformedValue); + + return null; + } + + return $transformedValue; + } + /** * @param EntryContract|Page|LocalizedTerm|mixed $item * @return array diff --git a/src/Services/Transformers/FieldTransformerFactory.php b/src/Services/Transformers/FieldTransformerFactory.php new file mode 100644 index 0000000..3d66c42 --- /dev/null +++ b/src/Services/Transformers/FieldTransformerFactory.php @@ -0,0 +1,15 @@ + $replicatorData + * @return array + */ + public function transform(array $replicatorData, ?string $setFilter, string $keyField, string $valueField): array + { + $result = []; + + foreach ($replicatorData as $row) { + $flatData = $this->extractFlatDataFromRow($row, $setFilter, $keyField, $valueField); + $result = array_merge($result, $flatData); + } + + return $result; + } + + /** + * @return array + */ + protected function extractFlatDataFromRow(mixed $row, ?string $setFilter, string $keyField, string $valueField): array + { + $originalRow = is_array($row) ? $row : []; + $directKey = isset($originalRow[$keyField]) ? $this->normalizer->unwrap($originalRow[$keyField]) : null; + $directValue = isset($originalRow[$valueField]) ? $this->normalizer->unwrap($originalRow[$valueField]) : null; + + if ($this->isValidKey($directKey)) { + /** @var array */ + return [(string) $directKey => $directValue]; + } + + $rowArray = $this->normalizer->normalize($row); + if (! $rowArray) { + return []; + } + + $rowSet = $rowArray['set'] ?? null; + if (! is_string($rowSet) && $rowSet !== null) { + $rowSet = null; + } + + if ($this->shouldSkipRowBySetFilter($rowSet, $setFilter)) { + return []; + } + + $rowValues = is_array($rowArray['values']) ? $rowArray['values'] : []; + + $key = isset($rowValues[$keyField]) ? $this->normalizer->unwrap($rowValues[$keyField]) : null; + $value = isset($rowValues[$valueField]) ? $this->normalizer->unwrap($rowValues[$valueField]) : null; + + if (($key === null || $value === null) && is_array($row)) { + $key ??= isset($row[$keyField]) ? $this->normalizer->unwrap($row[$keyField]) : null; + $value ??= isset($row[$valueField]) ? $this->normalizer->unwrap($row[$valueField]) : null; + } + + if ($this->isValidKey($key)) { + /** @var array */ + return [(string) $key => $value]; + } + + /** @var array */ + return $this->extractFromNestedStructures($rowValues, $keyField, $valueField); + } + + protected function shouldSkipRowBySetFilter(?string $rowSet, ?string $setFilter): bool + { + return is_string($setFilter) && $setFilter !== '' && $rowSet !== $setFilter; + } + + /** + * @param array $rowValues + * @return array + */ + protected function extractFromNestedStructures(array $rowValues, string $keyField, string $valueField): array + { + $nestedData = $this->extractFieldsFromNestedReplicators($rowValues, $keyField, $valueField); + if (! empty($nestedData)) { + return $nestedData; + } + + $recursiveData = $this->searchRecursivelyForFields($rowValues, $keyField, $valueField); + if (! empty($recursiveData)) { + return $recursiveData; + } + + return $this->extractFromRowValues($rowValues, $keyField, $valueField); + } + + /** + * @param array $rowValues + * @return array + */ + protected function extractFromRowValues(array $rowValues, string $keyField, string $valueField): array + { + $result = []; + + foreach ($rowValues as $fieldValue) { + $unwrapped = $this->normalizer->unwrap($fieldValue); + + if (! is_array($unwrapped)) { + continue; + } + + $extracted = $this->extractFromUnwrappedValue($unwrapped, $keyField, $valueField); + $result = array_merge($result, $extracted); + } + + return $result; + } + + /** + * @param array $unwrapped + * @return array + */ + protected function extractFromUnwrappedValue(array $unwrapped, string $keyField, string $valueField): array + { + if (isset($unwrapped[0]) && is_array($unwrapped[0])) { + /** @var array> $unwrapped */ + return $this->extractFromReplicatorRowsArray($unwrapped, $keyField, $valueField); + } + + if (isset($unwrapped['type']) || isset($unwrapped['set']) || isset($unwrapped['values'])) { + return $this->extractFromSingleReplicatorRow($unwrapped, $keyField, $valueField); + } + + return $this->searchRecursivelyForFields($unwrapped, $keyField, $valueField); + } + + /** + * @param array> $rows + * @return array + */ + protected function extractFromReplicatorRowsArray(array $rows, string $keyField, string $valueField): array + { + $result = []; + + foreach ($rows as $nestedRow) { + $extracted = $this->extractFromSingleReplicatorRow($nestedRow, $keyField, $valueField); + $result = array_merge($result, $extracted); + } + + return $result; + } + + /** + * @param mixed $row + * @return array + */ + protected function extractFromSingleReplicatorRow($row, string $keyField, string $valueField): array + { + $nestedRowArray = $this->normalizer->normalize($row); + if (! $nestedRowArray) { + return []; + } + + $nestedRowValues = $nestedRowArray['values'] ?? []; + if (! is_array($nestedRowValues)) { + return []; + } + + $key = isset($nestedRowValues[$keyField]) ? $this->normalizer->unwrap($nestedRowValues[$keyField]) : null; + $value = isset($nestedRowValues[$valueField]) ? $this->normalizer->unwrap($nestedRowValues[$valueField]) : null; + + if ($this->isValidKey($key)) { + /** @var array */ + return [(string) $key => $value]; + } + + return $this->searchRecursivelyForFields($nestedRowValues, $keyField, $valueField); + } + + /** + * @param array $rowValues + * @return array + */ + protected function extractFieldsFromNestedReplicators(array $rowValues, string $keyField, string $valueField): array + { + $result = []; + + foreach ($rowValues as $fieldValue) { + $unwrappedValue = $this->normalizer->unwrap($fieldValue); + + if (! is_array($unwrappedValue)) { + continue; + } + + $rowsToProcess = $this->getReplicatorRowsToProcess($unwrappedValue); + if ($rowsToProcess === null) { + $nestedResult = $this->searchRecursivelyForFields($unwrappedValue, $keyField, $valueField); + if (! empty($nestedResult)) { + $result = array_merge($result, $nestedResult); + } + + continue; + } + + foreach ($rowsToProcess as $nestedRow) { + $extracted = $this->extractFromSingleReplicatorRow($nestedRow, $keyField, $valueField); + $result = array_merge($result, $extracted); + } + } + + return $result; + } + + /** + * @param array $unwrappedValue + * @return array>|null + */ + protected function getReplicatorRowsToProcess(array $unwrappedValue): ?array + { + if (isset($unwrappedValue[0]) && is_array($unwrappedValue[0])) { + /** @var array> $unwrappedValue */ + return $unwrappedValue; + } + + if (isset($unwrappedValue['type']) || isset($unwrappedValue['set']) || isset($unwrappedValue['values'])) { + return [$unwrappedValue]; + } + + return null; + } + + /** + * @param array|mixed $data + * @return array + */ + protected function searchRecursivelyForFields($data, string $keyField, string $valueField): array + { + if (! is_array($data)) { + return []; + } + + $key = isset($data[$keyField]) ? $this->normalizer->unwrap($data[$keyField]) : null; + $value = isset($data[$valueField]) ? $this->normalizer->unwrap($data[$valueField]) : null; + + if ($this->isValidKey($key)) { + /** @var array */ + return [(string) $key => $value]; + } + + if ($this->isIndexedArray($data)) { + return $this->searchInIndexedArray($data, $keyField, $valueField); + } + + return $this->searchInAssociativeArray($data, $keyField, $valueField); + } + + /** + * @param array $data + */ + protected function isIndexedArray(array $data): bool + { + return ! empty($data) && array_keys($data) === range(0, count($data) - 1); + } + + /** + * @param array $data + * @return array + */ + protected function searchInIndexedArray(array $data, string $keyField, string $valueField): array + { + $result = []; + + foreach ($data as $row) { + $unwrapped = $this->normalizer->unwrap($row); + if (! is_array($unwrapped)) { + continue; + } + + $extracted = $this->extractFromNormalizedRow($unwrapped, $keyField, $valueField); + $result = array_merge($result, $extracted); + } + + return $result; + } + + /** + * @param array $data + * @return array + */ + protected function searchInAssociativeArray(array $data, string $keyField, string $valueField): array + { + $result = []; + + foreach ($data as $value) { + $unwrapped = $this->normalizer->unwrap($value); + if (! is_array($unwrapped)) { + continue; + } + + if (isset($unwrapped['type']) || isset($unwrapped['set']) || isset($unwrapped['values'])) { + $extracted = $this->extractFromSingleReplicatorRow($unwrapped, $keyField, $valueField); + } else { + $extracted = $this->searchRecursivelyForFields($unwrapped, $keyField, $valueField); + } + + $result = array_merge($result, $extracted); + } + + return $result; + } + + /** + * @param array $row + * @return array + */ + protected function extractFromNormalizedRow(array $row, string $keyField, string $valueField): array + { + $normalized = $this->normalizer->normalize($row); + if (! $normalized) { + return $this->searchRecursivelyForFields($row, $keyField, $valueField); + } + + $nestedValues = $normalized['values'] ?? []; + if (! is_array($nestedValues)) { + return []; + } + + $nestedKey = isset($nestedValues[$keyField]) ? $this->normalizer->unwrap($nestedValues[$keyField]) : null; + $nestedValue = isset($nestedValues[$valueField]) ? $this->normalizer->unwrap($nestedValues[$valueField]) : null; + + if ($this->isValidKey($nestedKey)) { + /** @var array */ + return [(string) $nestedKey => $nestedValue]; + } + + return $this->searchRecursivelyForFields($nestedValues, $keyField, $valueField); + } + + /** + * @phpstan-assert-if-true string|int|float $key + */ + protected function isValidKey(mixed $key): bool + { + return $key !== null && $key !== '' && (is_string($key) || is_numeric($key)); + } +} diff --git a/src/Services/Transformers/ReplicatorMappedTransformer.php b/src/Services/Transformers/ReplicatorMappedTransformer.php new file mode 100644 index 0000000..625b8fb --- /dev/null +++ b/src/Services/Transformers/ReplicatorMappedTransformer.php @@ -0,0 +1,135 @@ + $replicatorData + * @param array> $mappings + * @param mixed $item + * @return array> + */ + public function transform(array $replicatorData, ?string $setFilter, array $mappings, $item): array + { + $results = []; + + foreach ($replicatorData as $row) { + $rowArray = $this->normalizer->normalize($row); + + if (! $rowArray) { + continue; + } + + $rowSet = $rowArray['set'] ?? null; + + if (is_string($setFilter) && $setFilter !== '' && $rowSet !== $setFilter) { + continue; + } + + $rowValues = $rowArray['values']; + if (! is_array($rowValues)) { + $rowValues = []; + } + + $mapped = $this->applyMappings($mappings, $rowValues, $item); + + if (! empty($mapped)) { + $results[] = $mapped; + } + } + + return $results; + } + + /** + * @param array> $mappings + * @param array $rowValues + * @param mixed $item + * @return array + */ + protected function applyMappings(array $mappings, array $rowValues, $item): array + { + $mapped = []; + + foreach ($mappings as $mapping) { + $mappedKey = $mapping['key'] ?? null; + if (! is_string($mappedKey) || $mappedKey === '') { + continue; + } + + $mode = $mapping['mode'] ?? 'field'; + + if ($mode === 'static') { + $mapped[$mappedKey] = $mapping['static'] ?? null; + + continue; + } + + if ($mode === 'nested_replicator') { + $nestedField = [ + 'type' => 'replicator_object_array', + 'config' => $mapping['nested'] ?? [], + ]; + $mapped[$mappedKey] = $this->transformNested($nestedField, $item, $rowValues); + + continue; + } + + $fieldHandle = $mapping['field'] ?? null; + if (! is_string($fieldHandle) || $fieldHandle === '') { + continue; + } + + $mapped[$mappedKey] = $this->normalizer->unwrap($rowValues[$fieldHandle] ?? null); + } + + return $mapped; + } + + /** + * @param array $field + * @param mixed $item + * @param array|null $sourceData + * @return array> + */ + protected function transformNested(array $field, $item = null, ?array $sourceData = null): array + { + /** @var array|null $config */ + $config = $field['config'] ?? null; + + if (! is_array($config)) { + return []; + } + + $replicatorHandle = $config['replicator_field'] ?? null; + + if (! is_string($replicatorHandle) || $replicatorHandle === '') { + return []; + } + + $setFilter = is_string($config['set'] ?? null) ? $config['set'] : null; + /** @var array> $mappings */ + $mappings = is_array($config['mappings'] ?? null) ? $config['mappings'] : []; + + $replicatorData = null; + + if (is_array($sourceData) && array_key_exists($replicatorHandle, $sourceData)) { + $replicatorData = $sourceData[$replicatorHandle]; + } elseif (is_object($item) && method_exists($item, 'get')) { + $replicatorData = $item->get($replicatorHandle); + } + + $replicatorData = $this->normalizer->unwrap($replicatorData); + + if (! is_array($replicatorData)) { + return []; + } + + return $this->transform($replicatorData, $setFilter, $mappings, $item); + } +} diff --git a/src/Services/Transformers/ReplicatorObjectArrayTransformer.php b/src/Services/Transformers/ReplicatorObjectArrayTransformer.php new file mode 100644 index 0000000..bf04c6b --- /dev/null +++ b/src/Services/Transformers/ReplicatorObjectArrayTransformer.php @@ -0,0 +1,63 @@ +mappedTransformer = new ReplicatorMappedTransformer($this->normalizer); + $this->flatTransformer = new ReplicatorFlatTransformer($this->normalizer); + } + + /** + * @param array $field + * @param mixed $item + * @return array>|array + */ + public function transform(array $field, $item = null): array + { + /** @var array|null $config */ + $config = $field['config'] ?? null; + + if (! is_array($config)) { + return []; + } + + $replicatorHandle = $config['replicator_field'] ?? null; + + if (! is_string($replicatorHandle) || $replicatorHandle === '') { + return []; + } + + $setFilter = is_string($config['set'] ?? null) ? $config['set'] : null; + /** @var array> $mappings */ + $mappings = is_array($config['mappings'] ?? null) ? $config['mappings'] : []; + $flat = isset($config['flat']) && $config['flat'] === true; + $flatKeyField = is_string($config['flat_key_field'] ?? null) ? $config['flat_key_field'] : null; + $flatValueField = is_string($config['flat_value_field'] ?? null) ? $config['flat_value_field'] : null; + + $replicatorData = null; + + if (is_object($item) && method_exists($item, 'get')) { + $replicatorData = $item->get($replicatorHandle); + } + + $replicatorData = $this->normalizer->unwrap($replicatorData); + + if (! is_array($replicatorData)) { + return []; + } + + if ($flat && $flatKeyField && $flatValueField) { + return $this->flatTransformer->transform($replicatorData, $setFilter, $flatKeyField, $flatValueField); + } + + return $this->mappedTransformer->transform($replicatorData, $setFilter, $mappings, $item); + } +} diff --git a/src/Services/Transformers/ReplicatorRowNormalizer.php b/src/Services/Transformers/ReplicatorRowNormalizer.php new file mode 100644 index 0000000..f8a8a25 --- /dev/null +++ b/src/Services/Transformers/ReplicatorRowNormalizer.php @@ -0,0 +1,60 @@ +|null + */ + public function normalize($row): ?array + { + if ($row instanceof Value) { + $row = $row->value(); + } + + if ($row instanceof Collection) { + $row = $row->all(); + } + + if (! is_array($row)) { + return null; + } + + $set = $row['type'] ?? $row['set'] ?? null; + $values = $row['values'] ?? $row; + + if (! is_array($values)) { + $values = []; + } + + foreach ($values as $key => $value) { + $values[$key] = $this->unwrap($value); + } + + return [ + 'set' => is_string($set) ? $set : null, + 'values' => $values, + ]; + } + + /** + * @param mixed $value + */ + public function unwrap($value): mixed + { + if ($value instanceof Value) { + $value = $value->value(); + } + + if ($value instanceof Collection) { + $value = $value->all(); + } + + return $value; + } +}